1 // RUN: %clang_cc1 -finclude-default-header -triple \
2 // RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \
3 // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-DXIL
4 // RUN: %clang_cc1 -finclude-default-header -triple \
5 // RUN: spirv-pc-vulkan-compute %s -emit-llvm -disable-llvm-passes -o - | \
6 // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-SPV
8 // Test lowering of asdouble expansion to shuffle/bitcast and splat when required
10 // CHECK-LABEL: test_uint
11 double test_uint(uint low, uint high) {
12 // CHECK-SPV: %[[LOW_INSERT:.*]] = insertelement <1 x i32>
13 // CHECK-SPV: %[[LOW_SHUFFLE:.*]] = shufflevector <1 x i32> %[[LOW_INSERT]], {{.*}} zeroinitializer
14 // CHECK-SPV: %[[HIGH_INSERT:.*]] = insertelement <1 x i32>
15 // CHECK-SPV: %[[HIGH_SHUFFLE:.*]] = shufflevector <1 x i32> %[[HIGH_INSERT]], {{.*}} zeroinitializer
17 // CHECK-SPV: %[[SHUFFLE0:.*]] = shufflevector <1 x i32> %[[LOW_SHUFFLE]], <1 x i32> %[[HIGH_SHUFFLE]],
18 // CHECK-SPV-SAME: {{.*}} <i32 0, i32 1>
19 // CHECK-SPV: bitcast <2 x i32> %[[SHUFFLE0]] to double
21 // CHECK-DXIL: call double @llvm.dx.asdouble.i32
22 return asdouble(low, high);
25 // CHECK-DXIL: declare double @llvm.dx.asdouble.i32
27 // CHECK-LABEL: test_vuint
28 double3 test_vuint(uint3 low, uint3 high) {
29 // CHECK-SPV: %[[SHUFFLE1:.*]] = shufflevector
30 // CHECK-SPV-SAME: {{.*}} <i32 0, i32 3, i32 1, i32 4, i32 2, i32 5>
31 // CHECK-SPV: bitcast <6 x i32> %[[SHUFFLE1]] to <3 x double>
33 // CHECK-DXIL: call <3 x double> @llvm.dx.asdouble.v3i32
34 return asdouble(low, high);
37 // CHECK-DXIL: declare <3 x double> @llvm.dx.asdouble.v3i32