| 1 |
; REQUIRES: spirv-as |
| 2 |
; RUN: spirv-as --target-env spv1.0 -o %t.spv %s |
| 3 |
; RUN: spirv-val %t.spv |
| 4 |
; RUN: llvm-spirv -r -emit-opaque-pointers -o - %t.spv | llvm-dis | FileCheck %s |
| 5 |
OpCapability Addresses |
| 6 |
OpCapability Kernel |
| 7 |
OpCapability Int16 |
| 8 |
OpMemoryModel Physical32 OpenCL |
| 9 |
OpEntryPoint Kernel %1 "testSMod_v2i16" |
| 10 |
OpName %a "a" |
| 11 |
OpName %b "b" |
| 12 |
%void = OpTypeVoid |
| 13 |
%ushort = OpTypeInt 16 0 |
| 14 |
%ushort2 = OpTypeVector %ushort 2 |
| 15 |
%5 = OpTypeFunction %void %ushort2 %ushort2 |
| 16 |
%1 = OpFunction %void None %5 |
| 17 |
%a = OpFunctionParameter %ushort2 |
| 18 |
%b = OpFunctionParameter %ushort2 |
| 19 |
%6 = OpLabel |
| 20 |
%7 = OpSMod %ushort2 %a %b |
| 21 |
OpReturn |
| 22 |
OpFunctionEnd |
| 23 |
|
| 24 |
; CHECK-DAG: %srem.res = srem <2 x i16> %a, %b |
| 25 |
; CHECK-DAG: %xor.res = xor <2 x i16> {{%a, %b|%b, %a}} |
| 26 |
; CHECK-DAG: %cmpsign.res = icmp slt <2 x i16> %xor.res, zeroinitializer |
| 27 |
; CHECK-DAG: %cmpsrem.res = icmp ne <2 x i16> {{%srem\.res, zeroinitializer|zeroinitializer, %srem\.res}} |
| 28 |
; CHECK-DAG: %add.res = add nsw <2 x i16> {{%srem\.res, %b|%b, %srem\.res}} |
| 29 |
; CHECK-DAG: %cmp.res = and <2 x i1> {{%cmpsign\.res, %cmpsrem\.res|%cmpsrem\.res, %cmpsign\.res}} |
| 30 |
; CHECK: select <2 x i1> %cmp.res, <2 x i16> %add.res, <2 x i16> %srem.res |