; REQUIRES: regkeys, spirv-as, dg2-supported ; UNSUPPORTED: khronos-translator-9 ; RUN: spirv-as --target-env spv1.0 -o %t.spv %s ; RUN: ocloc compile -spirv_input -file %t.spv -device dg2 -options " -igc_opts 'ShaderDumpTranslationOnly=1'" 2>&1 | FileCheck %s --check-prefix=%SPV_CHECK_PREFIX% OpCapability Addresses OpCapability Kernel OpCapability Int16 OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %1 "testSMod_v2i16" OpName %a "a" OpName %b "b" %void = OpTypeVoid %ushort = OpTypeInt 16 0 %ushort2 = OpTypeVector %ushort 2 %5 = OpTypeFunction %void %ushort2 %ushort2 %1 = OpFunction %void None %5 %a = OpFunctionParameter %ushort2 %b = OpFunctionParameter %ushort2 %6 = OpLabel %7 = OpSMod %ushort2 %a %b OpReturn OpFunctionEnd ; CHECK-KHR-DAG: %srem.res = srem <2 x i16> %a, %b ; CHECK-KHR-DAG: %xor.res = xor <2 x i16> {{%a, %b|%b, %a}} ; CHECK-KHR-DAG: %cmpsign.res = icmp slt <2 x i16> %xor.res, zeroinitializer ; CHECK-KHR-DAG: %cmpsrem.res = icmp ne <2 x i16> {{%srem\.res, zeroinitializer|zeroinitializer, %srem\.res}} ; CHECK-KHR-DAG: %add.res = add nsw <2 x i16> {{%srem\.res, %b|%b, %srem\.res}} ; CHECK-KHR-DAG: %cmp.res = and <2 x i1> {{%cmpsign\.res, %cmpsrem\.res|%cmpsrem\.res, %cmpsign\.res}} ; CHECK-KHR: select <2 x i1> %cmp.res, <2 x i16> %add.res, <2 x i16> %srem.res ; CHECK-LEGACY: [[TMP1:%.*]] = srem <2 x i16> %a, %b ; CHECK-LEGACY: [[TMP2:%.*]] = ashr <2 x i16> %a, ; CHECK-LEGACY: [[TMP3:%.*]] = ashr <2 x i16> %b, ; CHECK-LEGACY: [[TMP4:%.*]] = icmp ne <2 x i16> [[TMP2]], [[TMP3]] ; CHECK-LEGACY: [[TMP5:%.*]] = icmp ne <2 x i16> [[TMP1]], zeroinitializer ; CHECK-LEGACY: [[TMP6:%.*]] = and <2 x i1> [[TMP4]], [[TMP5]] ; CHECK-LEGACY: [[TMP7:%.*]] = add <2 x i16> [[TMP1]], %b ; CHECK-LEGACY: select <2 x i1> [[TMP6]], <2 x i16> [[TMP7]], <2 x i16> [[TMP1]]