|
| 1 | +; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s |
| 2 | +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 3 | + |
| 4 | +; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s |
| 5 | +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} |
| 6 | + |
| 7 | +; CHECK: OpExtInstImport "OpenCL.std" |
| 8 | +; CHECK-DAG: OpName %[[#Foo:]] "foo" |
| 9 | +; CHECK-DAG: OpName %[[#Bar:]] "bar" |
| 10 | +; CHECK: %[[#Foo]] = OpFunction |
| 11 | +; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] u_add_sat |
| 12 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] u_sub_sat |
| 13 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] s_add_sat |
| 14 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] s_sub_sat |
| 15 | +; CHECK: %[[#Bar]] = OpFunction |
| 16 | +; CHECK: %[[#]] = OpExtInst %[[#]] %[[#]] u_add_sat |
| 17 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] u_sub_sat |
| 18 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] s_add_sat |
| 19 | +; CHECK-NEXT: %[[#]] = OpExtInst %[[#]] %[[#]] s_sub_sat |
| 20 | + |
| 21 | +define spir_func void @foo(i16 %x, i16 %y) { |
| 22 | +entry: |
| 23 | + %r1 = tail call i16 @llvm.uadd.sat.i16(i16 %x, i16 %y) |
| 24 | + %r2 = tail call i16 @llvm.usub.sat.i16(i16 %x, i16 %y) |
| 25 | + %r3 = tail call i16 @llvm.sadd.sat.i16(i16 %x, i16 %y) |
| 26 | + %r4 = tail call i16 @llvm.ssub.sat.i16(i16 %x, i16 %y) |
| 27 | + ret void |
| 28 | +} |
| 29 | + |
| 30 | +define spir_func void @bar(<4 x i32> %x, <4 x i32> %y) { |
| 31 | +entry: |
| 32 | + %r1 = tail call <4 x i32> @llvm.uadd.sat.v4i32(<4 x i32> %x, <4 x i32> %y) |
| 33 | + %r2 = tail call <4 x i32> @llvm.usub.sat.v4i32(<4 x i32> %x, <4 x i32> %y) |
| 34 | + %r3 = tail call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %x, <4 x i32> %y) |
| 35 | + %r4 = tail call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %x, <4 x i32> %y) |
| 36 | + ret void |
| 37 | +} |
0 commit comments