; 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 OpMemoryModel Physical32 OpenCL OpEntryPoint Kernel %1 "testSMod_i32" OpName %a "a" OpName %b "b" %void = OpTypeVoid %uint = OpTypeInt 32 0 %5 = OpTypeFunction %void %uint %uint %1 = OpFunction %void None %5 %a = OpFunctionParameter %uint %b = OpFunctionParameter %uint %6 = OpLabel %7 = OpSMod %uint %a %b OpReturn OpFunctionEnd ; CHECK-KHR-DAG: %srem.res = srem i32 %a, %b ; CHECK-KHR-DAG: %xor.res = xor i32 {{%a, %b|%b, %a}} ; CHECK-KHR-DAG: %cmpsign.res = icmp slt i32 %xor.res, 0 ; CHECK-KHR-DAG: %cmpsrem.res = icmp ne i32 {{%srem\.res, 0|0, %srem\.res}} ; CHECK-KHR-DAG: %add.res = add nsw i32 {{%srem\.res, %b|%b, %srem\.res}} ; CHECK-KHR-DAG: %cmp.res = and i1 {{%cmpsign\.res, %cmpsrem\.res|%cmpsrem\.res, %cmpsign\.res}} ; CHECK-KHR: select i1 %cmp.res, i32 %add.res, i32 %srem.res ; CHECK-LEGACY-DAG: [[TMP1:%.*]] = srem i32 %a, %b ; CHECK-LEGACY-DAG: [[TMP2:%.*]] = ashr i32 %a, 31 ; CHECK-LEGACY-DAG: [[TMP3:%.*]] = ashr i32 %b, 31 ; CHECK-LEGACY-DAG: [[TMP4:%.*]] = icmp ne i32 [[TMP2]], [[TMP3]] ; CHECK-LEGACY-DAG: [[TMP5:%.*]] = icmp ne i32 [[TMP1]], 0 ; CHECK-LEGACY-DAG: [[TMP6:%.*]] = and i1 [[TMP4]], [[TMP5]] ; CHECK-LEGACY-DAG: [[TMP7:%.*]] = add i32 [[TMP1]], %b ; CHECK-LEGACY: select i1 [[TMP6]], i32 [[TMP7]], i32 [[TMP1]]