|
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 |
2 | 5 |
|
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 |
4 | 9 |
|
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 |
15 | 23 |
|
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