-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[DirectX] make firstbitlow intrinsic use first argument instead of return for overload type #145350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…turn for overload type fixes llvm#144966 Easy fix just add `dx_firstbitlow` to `DirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg`
@llvm/pr-subscribers-backend-directx Author: Farzon Lotfi (farzonl) Changes…turn for overload type fixes #144966 Full diff: https://github.com/llvm/llvm-project/pull/145350.diff 2 Files Affected:
diff --git a/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.cpp b/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.cpp
index e426c5249f930..84b2603b4c575 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.cpp
@@ -30,6 +30,7 @@ bool DirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID,
switch (ID) {
case Intrinsic::dx_asdouble:
case Intrinsic::dx_isinf:
+ case Intrinsic::dx_firstbitlow:
return OpdIdx == 0;
default:
return OpdIdx == -1;
diff --git a/llvm/test/CodeGen/DirectX/firstbitlow.ll b/llvm/test/CodeGen/DirectX/firstbitlow.ll
index 884ec1164fc99..fe3786d3fbebf 100644
--- a/llvm/test/CodeGen/DirectX/firstbitlow.ll
+++ b/llvm/test/CodeGen/DirectX/firstbitlow.ll
@@ -41,7 +41,20 @@ entry:
ret <4 x i32> %2
}
-declare i32 @llvm.dx.firstbitlow.i16(i16)
-declare i32 @llvm.dx.firstbitlow.i32(i32)
-declare i32 @llvm.dx.firstbitlow.i64(i64)
-declare <4 x i32> @llvm.dx.firstbitlow.v4i32(<4 x i32>)
+define noundef <4 x i32> @test_firstbitlow_vec4_i16(<4 x i16> noundef %a) {
+entry:
+ ; CHECK: [[ee0:%.*]] = extractelement <4 x i16> %a, i64 0
+ ; CHECK: [[ie0:%.*]] = call i32 @dx.op.unaryBits.i16(i32 32, i16 [[ee0]])
+ ; CHECK: [[ee1:%.*]] = extractelement <4 x i16> %a, i64 1
+ ; CHECK: [[ie1:%.*]] = call i32 @dx.op.unaryBits.i16(i32 32, i16 [[ee1]])
+ ; CHECK: [[ee2:%.*]] = extractelement <4 x i16> %a, i64 2
+ ; CHECK: [[ie2:%.*]] = call i32 @dx.op.unaryBits.i16(i32 32, i16 [[ee2]])
+ ; CHECK: [[ee3:%.*]] = extractelement <4 x i16> %a, i64 3
+ ; CHECK: [[ie3:%.*]] = call i32 @dx.op.unaryBits.i16(i32 32, i16 [[ee3]])
+ ; CHECK: insertelement <4 x i32> poison, i32 [[ie0]], i64 0
+ ; CHECK: insertelement <4 x i32> %{{.*}}, i32 [[ie1]], i64 1
+ ; CHECK: insertelement <4 x i32> %{{.*}}, i32 [[ie2]], i64 2
+ ; CHECK: insertelement <4 x i32> %{{.*}}, i32 [[ie3]], i64 3
+ %2 = call <4 x i32> @llvm.dx.firstbitlow.v4i16(<4 x i16> %a)
+ ret <4 x i32> %2
+}
|
Build failure is thats an existing test failure. |
Note: This change needs to me made for first bit high as well. I'll do that in a follow up |
…turn for overload type (llvm#145350) fixes llvm#144966 Easy fix just add `dx_firstbitlow` to `DirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg`
…rload type (#145401) Sibling to llvm/llvm-project#145350 part of llvm/llvm-project#144966 firstbituhigh and firstbitshigh should use the first arg for overloads instead of the return type since the return is always i32
…lvm#145401) Sibling to llvm#145350 part of llvm#144966 firstbituhigh and firstbitshigh should use the first arg for overloads instead of the return type since the return is always i32
…turn for overload type (llvm#145350) fixes llvm#144966 Easy fix just add `dx_firstbitlow` to `DirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg`
…lvm#145401) Sibling to llvm#145350 part of llvm#144966 firstbituhigh and firstbitshigh should use the first arg for overloads instead of the return type since the return is always i32
fixes #144966
Easy fix just add
dx_firstbitlow
toDirectXTTIImpl::isTargetIntrinsicWithOverloadTypeAtArg