Skip to content

Commit 0109271

Browse files
committed
Reorganize tests to lower llvm.sin.*.
This pattern of tests will facilitate use of same test sources to test lowering of various combinations of options.
1 parent 47df485 commit 0109271

File tree

4 files changed

+29
-32
lines changed

4 files changed

+29
-32
lines changed

llvm/test/CodeGen/DirectX/sin_error.ll renamed to llvm/test/CodeGen/DirectX/Inputs/sin/double.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %s 2>&1 | FileCheck %s
2-
3-
; DXIL operation sin does not support double overload type
4-
; CHECK: LLVM ERROR: Invalid Overload
51

62
define noundef double @sin_double(double noundef %a) #0 {
73
entry:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
; Function Attrs: noinline nounwind optnone
2+
define noundef float @sin_float(float noundef %a) #0 {
3+
entry:
4+
%a.addr = alloca float, align 4
5+
store float %a, ptr %a.addr, align 4
6+
%0 = load float, ptr %a.addr, align 4
7+
%1 = call float @llvm.sin.f32(float %0)
8+
ret float %1
9+
}
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
; RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.0-library %s 2>&1 | FileCheck %s
2-
3-
; DXIL operation sin does not support half overload type in SM6.0
4-
; CHECK: LLVM ERROR: Invalid Overload
5-
61
; Function Attrs: noinline nounwind optnone
72
define noundef half @sin_half(half noundef %a) #0 {
83
entry:
94
%a.addr = alloca half, align 2
105
store half %a, ptr %a.addr, align 2
116
%0 = load half, ptr %a.addr, align 2
12-
; SM6_3: call half @dx.op.unary.f16(i32 13, half %{{.*}})
137
%1 = call half @llvm.sin.f16(half %0)
148
ret half %1
159
}

llvm/test/CodeGen/DirectX/sin.ll

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
; RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library < %s | FileCheck %s -check-prefix=SM6_3
1+
// Shader Mode 6.0
2+
// RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.0-library %S/Inputs/sin/half.ll 2>&1 | FileCheck %s -check-prefix=SM6_0_HALF
3+
// RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.0-library %S/Inputs/sin/float.ll | FileCheck %s -check-prefix=SM6_0_FLOAT
4+
// RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.0-library %S/inputs/sin/double.ll 2>&1 | FileCheck %s --check-prefix=SM6_0_DOUBLE
25

3-
; Make sure dxil operation function calls for sin are generated for float and half.
6+
// RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %S/Inputs/sin/half.ll | FileCheck %s -check-prefix=SM6_3_HALF
7+
// RUN: opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %S/Inputs/sin/float.ll | FileCheck %s -check-prefix=SM6_3_FLOAT
8+
// RUN: not opt -S -dxil-op-lower -mtriple=dxil-pc-shadermodel6.3-library %S/inputs/sin/double.ll 2>&1 | FileCheck %s --check-prefix=SM6_3_DOUBLE
49

5-
; Function Attrs: noinline nounwind optnone
6-
define noundef float @sin_float(float noundef %a) #0 {
7-
entry:
8-
%a.addr = alloca float, align 4
9-
store float %a, ptr %a.addr, align 4
10-
%0 = load float, ptr %a.addr, align 4
11-
; SM6_3: call float @dx.op.unary.f32(i32 13, float %{{.*}})
12-
%1 = call float @llvm.sin.f32(float %0)
13-
ret float %1
14-
}
10+
// Float is valid for SM6.0
11+
// SM6_0_FLOAT: call float @dx.op.unary.f32(i32 13, float %{{.*}})
12+
13+
// Half is not valid for SM6.0
14+
// SM6_0_HALF: LLVM ERROR: Invalid Overload
15+
16+
// Half and float are valid for SM6.2 and later
17+
// SM6_3_HALF: call half @dx.op.unary.f16(i32 13, half %{{.*}})
18+
// SM6_3_FLOAT: call float @dx.op.unary.f32(i32 13, float %{{.*}})
19+
20+
// Double is not valid in any Shader Model version
21+
// SM6_0_DOUBLE: LLVM ERROR: Invalid Overload
22+
// SM6_3_DOUBLE: LLVM ERROR: Invalid Overload
1523

16-
; Function Attrs: noinline nounwind optnone
17-
define noundef half @sin_half(half noundef %a) #0 {
18-
entry:
19-
%a.addr = alloca half, align 2
20-
store half %a, ptr %a.addr, align 2
21-
%0 = load half, ptr %a.addr, align 2
22-
; SM6_3: call half @dx.op.unary.f16(i32 13, half %{{.*}})
23-
%1 = call half @llvm.sin.f16(half %0)
24-
ret half %1
25-
}

0 commit comments

Comments
 (0)