CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
109 lines
4.7 KiB
HLSL
109 lines
4.7 KiB
HLSL
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.3-library -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s
|
|
|
|
// CHECK: %struct.S = type { <2 x i32>, float }
|
|
// CHECK: [[ConstS:@.*]] = private unnamed_addr constant %struct.S { <2 x i32> splat (i32 1), float 1.000000e+00 }, align 1
|
|
// CHECK: [[ConstArr:.*]] = private unnamed_addr constant [2 x <2 x i32>] [<2 x i32> splat (i32 1), <2 x i32> zeroinitializer], align 4
|
|
|
|
struct S {
|
|
bool2 bv;
|
|
float f;
|
|
};
|
|
|
|
// CHECK-LABEL: define hidden noundef i1 {{.*}}fn1{{.*}}
|
|
// CHECK: [[B:%.*]] = alloca <2 x i32>, align 4
|
|
// CHECK-NEXT: store <2 x i32> splat (i32 1), ptr [[B]], align 4
|
|
// CHECK-NEXT: [[BoolVec:%.*]] = load <2 x i32>, ptr [[B]], align 4
|
|
// CHECK-NEXT: [[L:%.*]] = icmp ne <2 x i32> [[BoolVec:%.*]], zeroinitializer
|
|
// CHECK-NEXT: [[VecExt:%.*]] = extractelement <2 x i1> [[L]], i32 0
|
|
// CHECK-NEXT: ret i1 [[VecExt]]
|
|
bool fn1() {
|
|
bool2 B = {true,true};
|
|
return B[0];
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden noundef <2 x i1> {{.*}}fn2{{.*}}
|
|
// CHECK: [[VAddr:%.*]] = alloca i32, align 4
|
|
// CHECK-NEXT: [[A:%.*]] = alloca <2 x i32>, align 4
|
|
// CHECK-NEXT: [[StoreV:%.*]] = zext i1 {{.*}} to i32
|
|
// CHECK-NEXT: store i32 [[StoreV]], ptr [[VAddr]], align 4
|
|
// CHECK-NEXT: [[L:%.*]] = load i32, ptr [[VAddr]], align 4
|
|
// CHECK-NEXT: [[LoadV:%.*]] = icmp ne i32 [[L]], 0
|
|
// CHECK-NEXT: [[Vec:%.*]] = insertelement <2 x i1> poison, i1 [[LoadV]], i32 0
|
|
// CHECK-NEXT: [[Vec1:%.*]] = insertelement <2 x i1> [[Vec]], i1 true, i32 1
|
|
// CHECK-NEXT: [[Z:%.*]] = zext <2 x i1> [[Vec1]] to <2 x i32>
|
|
// CHECK-NEXT: store <2 x i32> [[Z]], ptr [[A]], align 4
|
|
// CHECK-NEXT: [[LoadBV:%.*]] = load <2 x i32>, ptr [[A]], align 4
|
|
// CHECK-NEXT: [[LoadV2:%.*]] = icmp ne <2 x i32> [[LoadBV]], zeroinitializer
|
|
// CHECK-NEXT: ret <2 x i1> [[LoadV2]]
|
|
bool2 fn2(bool V) {
|
|
bool2 A = {V,true};
|
|
return A;
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden noundef i1 {{.*}}fn3{{.*}}
|
|
// CHECK: [[s:%.*]] = alloca %struct.S, align 1
|
|
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[s]], ptr align 1 [[ConstS]], i32 12, i1 false)
|
|
// CHECK-NEXT: [[BV:%.*]] = getelementptr inbounds nuw %struct.S, ptr [[s]], i32 0, i32 0
|
|
// CHECK-NEXT: [[LBV:%.*]] = load <2 x i32>, ptr [[BV]], align 1
|
|
// CHECK-NEXT: [[LV:%.*]] = icmp ne <2 x i32> [[LBV]], zeroinitializer
|
|
// CHECK-NEXT: [[VX:%.*]] = extractelement <2 x i1> [[LV]], i32 0
|
|
// CHECK-NEXT: ret i1 [[VX]]
|
|
bool fn3() {
|
|
S s = {{true,true}, 1.0};
|
|
return s.bv[0];
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden noundef i1 {{.*}}fn4{{.*}}
|
|
// CHECK: [[Arr:%.*]] = alloca [2 x <2 x i32>], align 4
|
|
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[Arr]], ptr align 4 [[ConstArr]], i32 16, i1 false)
|
|
// CHECK-NEXT: [[Idx:%.*]] = getelementptr inbounds [2 x <2 x i32>], ptr [[Arr]], i32 0, i32 0
|
|
// CHECK-NEXT: [[L:%.*]] = load <2 x i32>, ptr [[Idx]], align 4
|
|
// CHECK-NEXT: [[LV:%.*]] = icmp ne <2 x i32> [[L]], zeroinitializer
|
|
// CHECK-NEXT: [[VX:%.*]] = extractelement <2 x i1> [[LV]], i32 1
|
|
// CHECK-NEXT: ret i1 [[VX]]
|
|
bool fn4() {
|
|
bool2 Arr[2] = {{true,true}, {false,false}};
|
|
return Arr[0][1];
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden void {{.*}}fn5{{.*}}
|
|
// CHECK: [[Arr:%.*]] = alloca <2 x i32>, align 4
|
|
// CHECK-NEXT: store <2 x i32> splat (i32 1), ptr [[Arr]], align 4
|
|
// CHECK-NEXT: [[Ptr:%.*]] = getelementptr <2 x i32>, ptr [[Arr]]
|
|
// CHECK-NEXT: store i32 0, ptr [[Ptr]], align 4
|
|
// CHECK-NEXT: ret void
|
|
void fn5() {
|
|
bool2 Arr = {true,true};
|
|
Arr[1] = false;
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden void {{.*}}fn6{{.*}}
|
|
// CHECK: [[V:%.*]] = alloca i32, align 4
|
|
// CHECK-NEXT: [[S:%.*]] = alloca %struct.S, align 1
|
|
// CHECK-NEXT: store i32 0, ptr [[V]], align 4
|
|
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[S]], ptr align 1 {{.*}}, i32 12, i1 false)
|
|
// CHECK-NEXT: [[Y:%.*]] = load i32, ptr [[V]], align 4
|
|
// CHECK-NEXT: [[LV:%.*]] = icmp ne i32 [[Y]], 0
|
|
// CHECK-NEXT: [[BV:%.*]] = getelementptr inbounds nuw %struct.S, ptr [[S]], i32 0, i32 0
|
|
// CHECK-NEXT: [[Z:%.*]] = zext i1 [[LV]] to i32
|
|
// CHECK-NEXT: [[Ptr:%.*]] = getelementptr <2 x i32>, ptr [[BV]], i32 0, i32 1
|
|
// CHECK-NEXT: store i32 [[Z]], ptr [[Ptr]], align 4
|
|
// CHECK-NEXT: ret void
|
|
void fn6() {
|
|
bool V = false;
|
|
S s = {{true,true}, 1.0};
|
|
s.bv[1] = V;
|
|
}
|
|
|
|
// CHECK-LABEL: define hidden void {{.*}}fn7{{.*}}
|
|
// CHECK: [[Arr:%.*]] = alloca [2 x <2 x i32>], align 4
|
|
// CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 [[Arr]], ptr align 4 {{.*}}, i32 16, i1 false)
|
|
// CHECK-NEXT: [[Idx:%.*]] = getelementptr inbounds [2 x <2 x i32>], ptr [[Arr]], i32 0, i32 0
|
|
// CHECK-NEXT: %[[Ptr:.*]] = getelementptr <2 x i32>, ptr [[Idx]], i32 0, i32 1
|
|
// CHECK-NEXT: store i32 0, ptr %[[Ptr]], align 4
|
|
// CHECK-NEXT: ret void
|
|
void fn7() {
|
|
bool2 Arr[2] = {{true,true}, {false,false}};
|
|
Arr[0][1] = false;
|
|
}
|