38 lines · plain
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-DXIL4// 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-SPV7 8// Test lowering of asdouble expansion to shuffle/bitcast and splat when required9 10// CHECK-LABEL: test_uint11double 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]], {{.*}} zeroinitializer14 // CHECK-SPV: %[[HIGH_INSERT:.*]] = insertelement <1 x i32>15 // CHECK-SPV: %[[HIGH_SHUFFLE:.*]] = shufflevector <1 x i32> %[[HIGH_INSERT]], {{.*}} zeroinitializer16 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 double20 21 // CHECK-DXIL: call reassoc nnan ninf nsz arcp afn double @llvm.dx.asdouble.i3222 return asdouble(low, high);23}24 25// CHECK-DXIL: declare double @llvm.dx.asdouble.i3226 27// CHECK-LABEL: test_vuint28double3 test_vuint(uint3 low, uint3 high) {29 // CHECK-SPV: %[[SHUFFLE1:.*]] = shufflevector30 // 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>32 33 // CHECK-DXIL: call reassoc nnan ninf nsz arcp afn <3 x double> @llvm.dx.asdouble.v3i3234 return asdouble(low, high);35}36 37// CHECK-DXIL: declare <3 x double> @llvm.dx.asdouble.v3i3238