[DirectX][Scalarizer] Make sure TargetTransformInfoWrapperPass is setup - #216893
[DirectX][Scalarizer] Make sure TargetTransformInfoWrapperPass is setup#216893farzonl wants to merge 1 commit into
Conversation
fixes llvm#216888 In the process of testing the scalarization of HLSL long vectors I discoved that some intrinsics were crashing when used with llc but not when used with opt -scalarizer. This change makes sure that we have setup TargetTransformInfoWrapperPass so that we can call the DirectX versions of `isTargetIntrinsicWithScalarOpAtArg` and `isTargetIntrinsicWithOverloadTypeAtArg`.
|
@llvm/pr-subscribers-llvm-transforms @llvm/pr-subscribers-backend-directx Author: Farzon Lotfi (farzonl) Changesfixes #216888 In the process of testing the scalarization of HLSL long vectors I discoved that some intrinsics were crashing when used with llc but not when used with opt -scalarizer. This change makes sure that we have setup TargetTransformInfoWrapperPass so that we can call the DirectX versions of Patch is 54.47 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/216893.diff 77 Files Affected:
diff --git a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
index 1240e7cda597e..13d6b4f2ae81a 100644
--- a/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
+++ b/llvm/lib/Target/DirectX/DirectXTargetMachine.cpp
@@ -34,6 +34,7 @@
#include "DirectXSubtarget.h"
#include "DirectXTargetTransformInfo.h"
#include "TargetInfo/DirectXTargetInfo.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetPassConfig.h"
@@ -170,6 +171,7 @@ bool DirectXTargetMachine::addPassesToEmitFile(
CodeGenFileType FileType, bool DisableVerify,
MachineModuleInfoWrapperPass *MMIWP) {
TargetPassConfig *PassConfig = createPassConfig(PM);
+ PM.add(createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
PassConfig->addCodeGenPrepare();
switch (FileType) {
diff --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
index 006f4c13d045e..280a36ca02897 100644
--- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
@@ -364,6 +364,7 @@ char ScalarizerLegacyPass::ID = 0;
INITIALIZE_PASS_BEGIN(ScalarizerLegacyPass, "scalarizer",
"Scalarize vector operations", false, false)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
INITIALIZE_PASS_END(ScalarizerLegacyPass, "scalarizer",
"Scalarize vector operations", false, false)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/asdouble-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/asdouble-sm69.ll
new file mode 100644
index 0000000000000..7d31c31a87a6e
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/asdouble-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x double> @test_asdouble(
+; CHECK: call <17 x double> @llvm.dx.asdouble.v17i32
+define <17 x double> @test_asdouble(<17 x i32> %a, <17 x i32> %b) {
+ %result = call <17 x double> @llvm.dx.asdouble.v17i32(<17 x i32> %a, <17 x i32> %b)
+ ret <17 x double> %result
+}
+declare <17 x double> @llvm.dx.asdouble.v17i32(<17 x i32>, <17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/asdouble.ll b/llvm/test/CodeGen/DirectX/LongVector/asdouble.ll
new file mode 100644
index 0000000000000..84c20636975b1
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/asdouble.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x double> @test_asdouble(
+; CHECK-COUNT-17: call double @dx.op.makeDouble.f64(i32 101, i32 {{.*}}, i32 {{.*}})
+define <17 x double> @test_asdouble(<17 x i32> %a, <17 x i32> %b) {
+ %result = call <17 x double> @llvm.dx.asdouble.v17i32(<17 x i32> %a, <17 x i32> %b)
+ ret <17 x double> %result
+}
+declare <17 x double> @llvm.dx.asdouble.v17i32(<17 x i32>, <17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse-sm69.ll
new file mode 100644
index 0000000000000..20419156a6634
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddx_coarse(
+; CHECK: call <17 x float> @llvm.dx.ddx.coarse.v17f32
+define <17 x float> @test_ddx_coarse(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddx.coarse.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddx.coarse.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse.ll b/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse.ll
new file mode 100644
index 0000000000000..0c8aa488a85db
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddx-coarse.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddx_coarse(
+; CHECK-COUNT-17: call float @dx.op.unary.f32(i32 83, float {{.*}})
+define <17 x float> @test_ddx_coarse(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddx.coarse.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddx.coarse.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddx-fine-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/ddx-fine-sm69.ll
new file mode 100644
index 0000000000000..c9444084ba33b
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddx-fine-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddx_fine(
+; CHECK: call <17 x float> @llvm.dx.ddx.fine.v17f32
+define <17 x float> @test_ddx_fine(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddx.fine.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddx.fine.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddx-fine.ll b/llvm/test/CodeGen/DirectX/LongVector/ddx-fine.ll
new file mode 100644
index 0000000000000..55aa92d918e40
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddx-fine.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddx_fine(
+; CHECK-COUNT-17: call float @dx.op.unary.f32(i32 85, float {{.*}})
+define <17 x float> @test_ddx_fine(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddx.fine.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddx.fine.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse-sm69.ll
new file mode 100644
index 0000000000000..d092521ad008b
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddy_coarse(
+; CHECK: call <17 x float> @llvm.dx.ddy.coarse.v17f32
+define <17 x float> @test_ddy_coarse(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddy.coarse.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddy.coarse.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse.ll b/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse.ll
new file mode 100644
index 0000000000000..45ca4c052740b
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddy-coarse.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddy_coarse(
+; CHECK-COUNT-17: call float @dx.op.unary.f32(i32 84, float {{.*}})
+define <17 x float> @test_ddy_coarse(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddy.coarse.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddy.coarse.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddy-fine-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/ddy-fine-sm69.ll
new file mode 100644
index 0000000000000..4bba04ccc3b9d
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddy-fine-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddy_fine(
+; CHECK: call <17 x float> @llvm.dx.ddy.fine.v17f32
+define <17 x float> @test_ddy_fine(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddy.fine.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddy.fine.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/ddy-fine.ll b/llvm/test/CodeGen/DirectX/LongVector/ddy-fine.ll
new file mode 100644
index 0000000000000..8baf8297cbb86
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/ddy-fine.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_ddy_fine(
+; CHECK-COUNT-17: call float @dx.op.unary.f32(i32 86, float {{.*}})
+define <17 x float> @test_ddy_fine(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.ddy.fine.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.ddy.fine.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbitlow-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbitlow-sm69.ll
new file mode 100644
index 0000000000000..0fef613afb9ac
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbitlow-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbitlow(
+; CHECK: call <17 x i32> @llvm.dx.firstbitlow.v17i32
+define <17 x i32> @test_firstbitlow(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbitlow.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbitlow.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbitlow.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbitlow.ll
new file mode 100644
index 0000000000000..e4cce428612e0
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbitlow.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbitlow(
+; CHECK-COUNT-17: call i32 @dx.op.unaryBits.i32(i32 32, i32 {{.*}})
+define <17 x i32> @test_firstbitlow(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbitlow.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbitlow.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh-sm69.ll
new file mode 100644
index 0000000000000..61a6a4ff308d3
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbitshigh(
+; CHECK: call <17 x i32> @llvm.dx.firstbitshigh.v17i32
+define <17 x i32> @test_firstbitshigh(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbitshigh.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbitshigh.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh.ll
new file mode 100644
index 0000000000000..24ed1f172f3d5
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbitshigh.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbitshigh(
+; CHECK-COUNT-17: call i32 @dx.op.unaryBits.i32(i32 34, i32 {{.*}})
+define <17 x i32> @test_firstbitshigh(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbitshigh.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbitshigh.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh-sm69.ll
new file mode 100644
index 0000000000000..2dbad82686316
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbituhigh(
+; CHECK: call <17 x i32> @llvm.dx.firstbituhigh.v17i32
+define <17 x i32> @test_firstbituhigh(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbituhigh.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbituhigh.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh.ll b/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh.ll
new file mode 100644
index 0000000000000..75b177d49b2a1
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/firstbituhigh.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_firstbituhigh(
+; CHECK-COUNT-17: call i32 @dx.op.unaryBits.i32(i32 33, i32 {{.*}})
+define <17 x i32> @test_firstbituhigh(<17 x i32> %a) {
+ %result = call <17 x i32> @llvm.dx.firstbituhigh.v17i32(<17 x i32> %a)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.firstbituhigh.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/frac-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/frac-sm69.ll
new file mode 100644
index 0000000000000..b8857c0db1e67
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/frac-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_frac(
+; CHECK: call <17 x float> @llvm.dx.frac.v17f32
+define <17 x float> @test_frac(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.frac.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.frac.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/frac.ll b/llvm/test/CodeGen/DirectX/LongVector/frac.ll
new file mode 100644
index 0000000000000..241303c8049fd
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/frac.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_frac(
+; CHECK-COUNT-17: call float @dx.op.unary.f32(i32 22, float {{.*}})
+define <17 x float> @test_frac(<17 x float> %a) {
+ %result = call <17 x float> @llvm.dx.frac.v17f32(<17 x float> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.frac.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/imad-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/imad-sm69.ll
new file mode 100644
index 0000000000000..267dd33adc6b0
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/imad-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_imad(
+; CHECK: call <17 x i32> @llvm.dx.imad.v17i32
+define <17 x i32> @test_imad(<17 x i32> %a, <17 x i32> %b, <17 x i32> %c) {
+ %result = call <17 x i32> @llvm.dx.imad.v17i32(<17 x i32> %a, <17 x i32> %b, <17 x i32> %c)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.imad.v17i32(<17 x i32>, <17 x i32>, <17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/imad.ll b/llvm/test/CodeGen/DirectX/LongVector/imad.ll
new file mode 100644
index 0000000000000..0613133320f15
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/imad.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_imad(
+; CHECK-COUNT-17: call i32 @dx.op.tertiary.i32(i32 48, i32 {{.*}}, i32 {{.*}}, i32 {{.*}})
+define <17 x i32> @test_imad(<17 x i32> %a, <17 x i32> %b, <17 x i32> %c) {
+ %result = call <17 x i32> @llvm.dx.imad.v17i32(<17 x i32> %a, <17 x i32> %b, <17 x i32> %c)
+ ret <17 x i32> %result
+}
+declare <17 x i32> @llvm.dx.imad.v17i32(<17 x i32>, <17 x i32>, <17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/isinf-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/isinf-sm69.ll
new file mode 100644
index 0000000000000..593dae2066da2
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/isinf-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i1> @test_isinf(
+; CHECK: call <17 x i1> @llvm.dx.isinf.v17f32
+define <17 x i1> @test_isinf(<17 x float> %a) {
+ %result = call <17 x i1> @llvm.dx.isinf.v17f32(<17 x float> %a)
+ ret <17 x i1> %result
+}
+declare <17 x i1> @llvm.dx.isinf.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/isinf.ll b/llvm/test/CodeGen/DirectX/LongVector/isinf.ll
new file mode 100644
index 0000000000000..c12b2774e5f54
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/isinf.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i1> @test_isinf(
+; CHECK-COUNT-17: call i1 @dx.op.isSpecialFloat.f32(i32 9, float {{.*}})
+define <17 x i1> @test_isinf(<17 x float> %a) {
+ %result = call <17 x i1> @llvm.dx.isinf.v17f32(<17 x float> %a)
+ ret <17 x i1> %result
+}
+declare <17 x i1> @llvm.dx.isinf.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/isnan-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/isnan-sm69.ll
new file mode 100644
index 0000000000000..003819d323d90
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/isnan-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i1> @test_isnan(
+; CHECK: call <17 x i1> @llvm.dx.isnan.v17f32
+define <17 x i1> @test_isnan(<17 x float> %a) {
+ %result = call <17 x i1> @llvm.dx.isnan.v17f32(<17 x float> %a)
+ ret <17 x i1> %result
+}
+declare <17 x i1> @llvm.dx.isnan.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/isnan.ll b/llvm/test/CodeGen/DirectX/LongVector/isnan.ll
new file mode 100644
index 0000000000000..91af7f2ac3dac
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/isnan.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i1> @test_isnan(
+; CHECK-COUNT-17: call i1 @dx.op.isSpecialFloat.f32(i32 8, float {{.*}})
+define <17 x i1> @test_isnan(<17 x float> %a) {
+ %result = call <17 x i1> @llvm.dx.isnan.v17f32(<17 x float> %a)
+ ret <17 x i1> %result
+}
+declare <17 x i1> @llvm.dx.isnan.v17f32(<17 x float>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32-sm69.ll
new file mode 100644
index 0000000000000..d256f642e8d0c
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_legacyf16tof32(
+; CHECK: call <17 x float> @llvm.dx.legacyf16tof32.v17i32
+define <17 x float> @test_legacyf16tof32(<17 x i32> %a) {
+ %result = call <17 x float> @llvm.dx.legacyf16tof32.v17i32(<17 x i32> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.legacyf16tof32.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32.ll b/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32.ll
new file mode 100644
index 0000000000000..1360002cdb3e6
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/legacyf16tof32.ll
@@ -0,0 +1,9 @@
+; RUN: llc -mtriple=dxil-pc-shadermodel6.8-library -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x float> @test_legacyf16tof32(
+; CHECK-COUNT-17: call float @dx.op.legacyF16ToF32(i32 131, i32 {{.*}})
+define <17 x float> @test_legacyf16tof32(<17 x i32> %a) {
+ %result = call <17 x float> @llvm.dx.legacyf16tof32.v17i32(<17 x i32> %a)
+ ret <17 x float> %result
+}
+declare <17 x float> @llvm.dx.legacyf16tof32.v17i32(<17 x i32>)
diff --git a/llvm/test/CodeGen/DirectX/LongVector/legacyf32tof16-sm69.ll b/llvm/test/CodeGen/DirectX/LongVector/legacyf32tof16-sm69.ll
new file mode 100644
index 0000000000000..8dc5c3586ffc5
--- /dev/null
+++ b/llvm/test/CodeGen/DirectX/LongVector/legacyf32tof16-sm69.ll
@@ -0,0 +1,10 @@
+; XFAIL: *
+; RUN: llc -mtriple=dxil-pc-shadermodel6.9-library -stop-before=dxil-op-lower -o - %s | FileCheck %s
+
+; CHECK-LABEL: define <17 x i32> @test_legacyf32tof16(
+; CHECK: call <17 x i32> @llvm.dx.legacyf32tof16.v17f32
+define <17 x i32> @test_legacyf32tof16(<17 x float> %a) {
+ %result = call <17 x i32> @llvm.dx.legacyf32tof16.v17f32(<17 x float> %a)
+ ret <17 x i32> %result
+}
+declare <17 x...
[truncated]
|
|
@bogner I have a change to turn off the scalarizer for SM6.9, but doing it right now would break all codegen if you target sm 6.9. So to track that work instead of turning off the scalarizer now I am just going to add the tests as |
fixes #216888
In the process of testing the scalarization of HLSL long vectors I discoved that some intrinsics were crashing when used with llc but not when used with opt -scalarizer. This change makes sure that we have setup TargetTransformInfoWrapperPass so that we can call the DirectX versions of
isTargetIntrinsicWithScalarOpAtArgandisTargetIntrinsicWithOverloadTypeAtArg.Assisted by Copilot with GPT 5.6-Sol