[clang] [llvm] [HLSL] implement elementwise firstbithigh hlsl builtin (PR #111082)

Sarah Spall via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 11:11:19 PDT 2024


================
@@ -37,13 +39,12 @@ define noundef i32 @firstbituhigh_i64(i64 noundef %a) {
 entry:
 ; CHECK: [[O:%.*]] = OpBitcast %[[#]] %[[#]]
 ; CHECK: [[N:%.*]] = OpExtInst %[[#]] %[[#]] FindUMsb [[O]]
-; CHECK: [[M:%.*]] = OpVectorShuffle %[[#]] [[N]] [[N]] 0
-; CHECK: [[L:%.*]] = OpVectorShuffle %[[#]] [[N]] [[N]] 1
+; CHECK: [[M:%.*]] = OpVectorExtractDynamic %[[#]] [[N]] [[Z]]
+; CHECK: [[L:%.*]] = OpVectorExtractDynamic %[[#]] [[N]] [[X]]
----------------
spall wrote:

OpVectorShuffle requires the result type to be a vector. In the case we have a scalar i64, that would result in a vector of length 1 which is not supported in SPIRV.  So, instead in the scalar case we do a OpVectorExtractDynamic. 

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


More information about the cfe-commits mailing list