1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -dxil-intrinsic-expansion -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
define noundef i32 @sign_half(half noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_half(
; CHECK-SAME: half noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt half 0xH0000, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt half [[A]], 0xH0000
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.f16(half %a)
ret i32 %elt.sign
}
define noundef i32 @sign_float(float noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_float(
; CHECK-SAME: float noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt float 0.000000e+00, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt float [[A]], 0.000000e+00
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.f32(float %a)
ret i32 %elt.sign
}
define noundef i32 @sign_double(double noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_double(
; CHECK-SAME: double noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt double 0.000000e+00, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt double [[A]], 0.000000e+00
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.f64(double %a)
ret i32 %elt.sign
}
define noundef i32 @sign_i16(i16 noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_i16(
; CHECK-SAME: i16 noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt i16 0, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i16 [[A]], 0
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.i16(i16 %a)
ret i32 %elt.sign
}
define noundef i32 @sign_i32(i32 noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_i32(
; CHECK-SAME: i32 noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt i32 0, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[A]], 0
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.i32(i32 %a)
ret i32 %elt.sign
}
define noundef i32 @sign_i64(i64 noundef %a) {
; CHECK-LABEL: define noundef i32 @sign_i64(
; CHECK-SAME: i64 noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt i64 0, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i64 [[A]], 0
; CHECK-NEXT: [[TMP2:%.*]] = zext i1 [[TMP0]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = zext i1 [[TMP1]] to i32
; CHECK-NEXT: [[TMP4:%.*]] = sub i32 [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret i32 [[TMP4]]
;
entry:
%elt.sign = call i32 @llvm.dx.sign.i64(i64 %a)
ret i32 %elt.sign
}
define noundef <4 x i32> @sign_half_vector(<4 x half> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_half_vector(
; CHECK-SAME: <4 x half> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt <4 x half> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <4 x half> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4f16(<4 x half> %a)
ret <4 x i32> %elt.sign
}
define noundef <4 x i32> @sign_float_vector(<4 x float> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_float_vector(
; CHECK-SAME: <4 x float> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt <4 x float> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <4 x float> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4f32(<4 x float> %a)
ret <4 x i32> %elt.sign
}
define noundef <4 x i32> @sign_double_vector(<4 x double> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_double_vector(
; CHECK-SAME: <4 x double> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = fcmp olt <4 x double> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = fcmp olt <4 x double> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4f64(<4 x double> %a)
ret <4 x i32> %elt.sign
}
define noundef <4 x i32> @sign_i16_vector(<4 x i16> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_i16_vector(
; CHECK-SAME: <4 x i16> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt <4 x i16> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt <4 x i16> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4i16(<4 x i16> %a)
ret <4 x i32> %elt.sign
}
define noundef <4 x i32> @sign_i32_vector(<4 x i32> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_i32_vector(
; CHECK-SAME: <4 x i32> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt <4 x i32> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt <4 x i32> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4i32(<4 x i32> %a)
ret <4 x i32> %elt.sign
}
define noundef <4 x i32> @sign_i64_vector(<4 x i64> noundef %a) {
; CHECK-LABEL: define noundef <4 x i32> @sign_i64_vector(
; CHECK-SAME: <4 x i64> noundef [[A:%.*]]) {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt <4 x i64> zeroinitializer, [[A]]
; CHECK-NEXT: [[TMP1:%.*]] = icmp slt <4 x i64> [[A]], zeroinitializer
; CHECK-NEXT: [[TMP2:%.*]] = zext <4 x i1> [[TMP0]] to <4 x i32>
; CHECK-NEXT: [[TMP3:%.*]] = zext <4 x i1> [[TMP1]] to <4 x i32>
; CHECK-NEXT: [[TMP4:%.*]] = sub <4 x i32> [[TMP2]], [[TMP3]]
; CHECK-NEXT: ret <4 x i32> [[TMP4]]
;
entry:
%elt.sign = call <4 x i32> @llvm.dx.sign.v4i64(<4 x i64> %a)
ret <4 x i32> %elt.sign
}
declare i32 @llvm.dx.sign.f16(half)
declare i32 @llvm.dx.sign.f32(float)
declare i32 @llvm.dx.sign.f64(double)
declare i32 @llvm.dx.sign.i16(i16)
declare i32 @llvm.dx.sign.i32(i32)
declare i32 @llvm.dx.sign.i64(i64)
declare <4 x i32> @llvm.dx.sign.v4f16(<4 x half>)
declare <4 x i32> @llvm.dx.sign.v4f32(<4 x float>)
declare <4 x i32> @llvm.dx.sign.v4f64(<4 x double>)
declare <4 x i32> @llvm.dx.sign.v4i16(<4 x i16>)
declare <4 x i32> @llvm.dx.sign.v4i32(<4 x i32>)
declare <4 x i32> @llvm.dx.sign.v4i64(<4 x i64>)
|