xref: /llvm-project/llvm/test/CodeGen/SPIRV/lshr-constexpr.ll (revision f9c98068c852c1bb1ec029c2c8df8ace9605f16f)
1; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
5; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
6
7; CHECK-DAG: %[[#type_int32:]] = OpTypeInt 32 0
8; CHECK-DAG: %[[#type_int64:]] = OpTypeInt 64 0
9; CHECK-DAG: %[[#type_vec:]] = OpTypeVector %[[#type_int32]] 2
10; CHECK-DAG: %[[#const1:]] = OpConstant %[[#type_int32]] 1
11; CHECK-DAG: %[[#vec_const:]] = OpConstantComposite %[[#type_vec]] %[[#const1]] %[[#const1]]
12; CHECK-DAG: %[[#const32:]] = OpConstant %[[#type_int64]] 32
13
14; CHECK:     %[[#bitcast_res:]] = OpBitcast %[[#type_int64]] %[[#vec_const]]
15; CHECK:     %[[#shift_res:]] = OpShiftRightLogical %[[#type_int64]] %[[#bitcast_res]] %[[#const32]]
16
17define void @foo(i64* %arg) {
18entry:
19  %0 = lshr i64 bitcast (<2 x i32> <i32 1, i32 1> to i64), 32
20  store i64 %0, i64* %arg
21  ret void
22}
23