|
7 | 7 |
|
8 | 8 | // Test basic lowering to runtime function call.
|
9 | 9 |
|
| 10 | +// CHECK-LABEL: define {{.*}}test |
10 | 11 | float test(half2 p1, half2 p2, float p3) {
|
11 |
| - // CHECK-SPIRV: %[[MUL:.*]] = call {{.*}} half @llvm.spv.fdot.v2f16(<2 x half> %1, <2 x half> %2) |
12 |
| - // CHECK-SPIRV: %[[CONVERT:.*]] = fpext {{.*}} half %[[MUL:.*]] to float |
13 |
| - // CHECK-SPIRV: %[[C:.*]] = load float, ptr %c.addr, align 4 |
14 |
| - // CHECK-SPIRV: %[[RES:.*]] = fadd {{.*}} float %[[CONVERT:.*]], %[[C:.*]] |
15 |
| - // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @llvm.dx.dot2add.v2f16(<2 x half> %0, <2 x half> %1, float %2) |
| 12 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %1, <2 x half> {{.*}} %2, float {{.*}} %3) #3 {{.*}} |
| 13 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %0, <2 x half> {{.*}} %1, float {{.*}} %2) #2 |
16 | 14 | // CHECK: ret float %[[RES]]
|
17 | 15 | return dot2add(p1, p2, p3);
|
18 | 16 | }
|
| 17 | + |
| 18 | +// CHECK-LABEL: define {{.*}}test_float_arg2_type |
| 19 | +float test_float_arg2_type(half2 p1, float2 p2, float p3) { |
| 20 | + // CHECK-SPIRV: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %2 to <2 x half> |
| 21 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %1, <2 x half> {{.*}} %conv, float {{.*}} %3) #3 {{.*}} |
| 22 | + // CHECK-DXIL: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %1 to <2 x half> |
| 23 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %0, <2 x half> {{.*}} %conv, float {{.*}} %2) #2 |
| 24 | + // CHECK: ret float %[[RES]] |
| 25 | + return dot2add(p1, p2, p3); |
| 26 | +} |
| 27 | + |
| 28 | +// CHECK-LABEL: define {{.*}}test_float_arg1_type |
| 29 | +float test_float_arg1_type(float2 p1, half2 p2, float p3) { |
| 30 | + // CHECK-SPIRV: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %1 to <2 x half> |
| 31 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %2, float {{.*}} %3) #3 {{.*}} |
| 32 | + // CHECK-DXIL: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %0 to <2 x half> |
| 33 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %1, float {{.*}} %2) #2 |
| 34 | + // CHECK: ret float %[[RES]] |
| 35 | + return dot2add(p1, p2, p3); |
| 36 | +} |
| 37 | + |
| 38 | +// CHECK-LABEL: define {{.*}}test_double_arg3_type |
| 39 | +float test_double_arg3_type(half2 p1, half2 p2, double p3) { |
| 40 | + // CHECK-SPIRV: %conv = fptrunc reassoc nnan ninf nsz arcp afn double %3 to float |
| 41 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %1, <2 x half> {{.*}} %2, float {{.*}} %conv) #3 {{.*}} |
| 42 | + // CHECK-DXIL: %conv = fptrunc reassoc nnan ninf nsz arcp afn double %2 to float |
| 43 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %0, <2 x half> {{.*}} %1, float {{.*}} %conv) #2 |
| 44 | + // CHECK: ret float %[[RES]] |
| 45 | + return dot2add(p1, p2, p3); |
| 46 | +} |
| 47 | + |
| 48 | +// CHECK-LABEL: define {{.*}}test_float_arg1_arg2_type |
| 49 | +float test_float_arg1_arg2_type(float2 p1, float2 p2, float p3) { |
| 50 | + // CHECK-SPIRV: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %1 to <2 x half> |
| 51 | + // CHECK-SPIRV: %conv1 = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %2 to <2 x half> |
| 52 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %conv1, float {{.*}} %3) #3 {{.*}} |
| 53 | + // CHECK-DXIL: %conv = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %0 to <2 x half> |
| 54 | + // CHECK-DXIL: %conv1 = fptrunc reassoc nnan ninf nsz arcp afn <2 x float> %1 to <2 x half> |
| 55 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %conv1, float {{.*}} %2) #2 |
| 56 | + // CHECK: ret float %[[RES]] |
| 57 | + return dot2add(p1, p2, p3); |
| 58 | +} |
| 59 | + |
| 60 | +// CHECK-LABEL: define {{.*}}test_int16_arg1_arg2_type |
| 61 | +float test_int16_arg1_arg2_type(int16_t2 p1, int16_t2 p2, float p3) { |
| 62 | + // CHECK-SPIRV: %conv = sitofp <2 x i16> %1 to <2 x half> |
| 63 | + // CHECK-SPIRV: %conv1 = sitofp <2 x i16> %2 to <2 x half> |
| 64 | + // CHECK-SPIRV: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %conv1, float {{.*}} %3) #3 {{.*}} |
| 65 | + // CHECK-DXIL: %conv = sitofp <2 x i16> %0 to <2 x half> |
| 66 | + // CHECK-DXIL: %conv1 = sitofp <2 x i16> %1 to <2 x half> |
| 67 | + // CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @_ZN4hlsl7dot2addEDv2_DhS0_f(<2 x half> {{.*}} %conv, <2 x half> {{.*}} %conv1, float {{.*}} %2) #2 |
| 68 | + // CHECK: ret float %[[RES]] |
| 69 | + return dot2add(p1, p2, p3); |
| 70 | +} |
| 71 | + |
| 72 | +// CHECK-LABEL: define {{.*}}dot2add_impl |
| 73 | +// CHECK-SPIRV: %[[MUL:.*]] = call reassoc nnan ninf nsz arcp afn half @llvm.spv.fdot.v2f16(<2 x half> %1, <2 x half> %2) |
| 74 | +// CHECK-SPIRV: %[[CONV:.*]] = fpext reassoc nnan ninf nsz arcp afn half %[[MUL]] to float |
| 75 | +// CHECK-SPIRV: %[[C:.*]] = load float, ptr %c.addr, align 4 |
| 76 | +// CHECK-SPIRV: %[[RES:.*]] = fadd reassoc nnan ninf nsz arcp afn float %[[CONV]], %[[C]] |
| 77 | +// CHECK-DXIL: %[[RES:.*]] = call {{.*}} float @llvm.dx.dot2add.v2f16(<2 x half> %0, <2 x half> %1, float %2) |
| 78 | +// CHECK: ret float %[[RES]] |
0 commit comments