1 // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -std=hlsl202x -triple \
2 // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
3 // RUN: -o - | FileCheck %s
5 // RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -std=hlsl202x -triple \
6 // RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
7 // RUN: -o - -fexperimental-new-constant-interpreter | FileCheck %s
10 /// This test converts V to a 1-element vector and then .xx to a 2-element vector.
11 // CHECK-LABEL: ToTwoInts
12 // CHECK: [[splat:%.*]] = insertelement <1 x i32> poison, i32 {{.*}}, i64 0
13 // CHECK: [[vec2:%.*]] = shufflevector <1 x i32> [[splat]], <1 x i32> poison, <2 x i32> zeroinitializer
14 // CHECK: ret <2 x i32> [[vec2]]
15 int2 ToTwoInts(int V){
20 // This compiling successfully verifies that the vector constant expression
21 // gets truncated to an integer at compile time for instantiation.
22 _Static_assert(((int)1.xxxx) + 0 == 1, "Woo!");
24 // This compiling successfully verifies that the vector constant expression
25 // gets truncated to a float at compile time for instantiation.
26 _Static_assert(((float)1.0.xxxx) + 0.0 == 1.0, "Woo!");
28 // This compiling successfully verifies that a vector can be truncated to a
29 // smaller vector, then truncated to a float as a constant expression.
30 _Static_assert(((float2)float4(6, 5, 4, 3)).x == 6, "Woo!");