[clang] [clang][HLSL] Add sign intrinsic part 4 (PR #108396)

Tim Gymnich via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 16 12:19:34 PDT 2024


================
@@ -155,3 +197,24 @@ int3 test_sign_int64_t3(int64_t3 p0) { return sign(p0); }
 // CHECK: %hlsl.sign = call <4 x i32> @llvm.[[TARGET]].sign.v4i64(
 // CHECK: ret <4 x i32> %hlsl.sign
 int4 test_sign_int64_t4(int64_t4 p0) { return sign(p0); }
+
+
+// CHECK: define [[FNATTRS]] i32 @
+// CHECK: [[CMP:%.*]] = icmp eq i64 [[ARG:%.*]], 0
+// CHECK: %hlsl.sign = select i1 [[CMP]], i32 0, i32 1
+int test_sign_int64_t(uint64_t p0) { return sign(p0); }
----------------
tgymnich wrote:

https://github.com/llvm/llvm-project/pull/112602/files

https://github.com/llvm/llvm-project/pull/108396


More information about the cfe-commits mailing list