[spv-out] use SRem instead of SMod

This commit is contained in:
teoxoy
2022-04-28 17:21:05 +02:00
committed by Dzmitry Malyshau
parent 0d4098d634
commit 7109cffb20
3 changed files with 9 additions and 9 deletions

View File

@@ -529,7 +529,7 @@ impl<'w> BlockContext<'w> {
_ => unimplemented!(),
},
crate::BinaryOperator::Modulo => match left_ty_inner.scalar_kind() {
Some(crate::ScalarKind::Sint) => spirv::Op::SMod,
Some(crate::ScalarKind::Sint) => spirv::Op::SRem,
Some(crate::ScalarKind::Uint) => spirv::Op::UMod,
Some(crate::ScalarKind::Float) => spirv::Op::FRem,
_ => unimplemented!(),

View File

@@ -213,7 +213,7 @@ OpBranch %84
%88 = OpBitcast %21 %87
%89 = OpIMul %21 %85 %88
%90 = OpCompositeConstruct %21 %3 %5
%91 = OpSMod %21 %89 %90
%91 = OpSRem %21 %89 %90
%92 = OpCompositeExtract %13 %75 2
%93 = OpBitcast %4 %92
%95 = OpImageFetch %94 %78 %91 Lod %93
@@ -254,7 +254,7 @@ OpBranch %125
%128 = OpBitcast %21 %127
%129 = OpIMul %21 %126 %128
%130 = OpCompositeConstruct %21 %3 %5
%131 = OpSMod %21 %129 %130
%131 = OpSRem %21 %129 %130
%132 = OpCompositeExtract %13 %120 2
%133 = OpBitcast %4 %132
%134 = OpImageFetch %29 %122 %131 Sample %133

View File

@@ -115,7 +115,7 @@ OpBranch %81
%88 = OpFDiv %31 %86 %87
%89 = OpCompositeConstruct %27 %17 %17 %17 %17
%90 = OpCompositeConstruct %27 %18 %18 %18 %18
%91 = OpSMod %27 %89 %90
%91 = OpSRem %27 %89 %90
%92 = OpVectorShuffle %26 %88 %88 0 1 0 1
%93 = OpConvertSToF %26 %91
%94 = OpFAdd %26 %92 %93
@@ -233,12 +233,12 @@ OpBranch %151
%203 = OpCompositeConstruct %26 %14 %14 %14 %14
%204 = OpCompositeConstruct %26 %3 %3 %3 %3
%205 = OpFDiv %26 %203 %204
%206 = OpSMod %8 %18 %7
%206 = OpSRem %8 %18 %7
%207 = OpUMod %20 %24 %25
%208 = OpFRem %4 %14 %3
%209 = OpCompositeConstruct %152 %18 %18
%210 = OpCompositeConstruct %152 %7 %7
%211 = OpSMod %152 %209 %210
%211 = OpSRem %152 %209 %210
%212 = OpCompositeConstruct %163 %24 %24 %24
%213 = OpCompositeConstruct %163 %25 %25 %25
%214 = OpUMod %163 %212 %213
@@ -317,10 +317,10 @@ OpBranch %151
%287 = OpFDiv %31 %286 %285
%288 = OpCompositeConstruct %152 %18 %18
%289 = OpCompositeConstruct %152 %7 %7
%290 = OpSMod %152 %288 %289
%290 = OpSRem %152 %288 %289
%291 = OpCompositeConstruct %152 %7 %7
%292 = OpCompositeConstruct %152 %18 %18
%293 = OpSMod %152 %292 %291
%293 = OpSRem %152 %292 %291
%294 = OpCompositeConstruct %34 %24 %24
%295 = OpCompositeConstruct %34 %25 %25
%296 = OpUMod %34 %294 %295
@@ -512,7 +512,7 @@ OpStore %457 %468
%471 = OpSDiv %8 %469 %470
OpStore %457 %471
%472 = OpLoad %8 %457
%473 = OpSMod %8 %472 %7
%473 = OpSRem %8 %472 %7
OpStore %457 %473
%474 = OpLoad %8 %457
%475 = OpBitwiseAnd %8 %474 %11