File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed
test/Transforms/InstSimplify/ConstProp/WebAssembly Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change @@ -3842,9 +3842,7 @@ static Constant *ConstantFoldFixedVectorCall(
38423842 ConstantInt *Elt1 =
38433843 cast<ConstantInt>(Operands[1 ]->getAggregateElement (I));
38443844
3845- APInt IMul = Elt0->getValue ().sext (32 ) * Elt1->getValue ().sext (32 );
3846-
3847- MulVector[I] = IMul.getSExtValue ();
3845+ MulVector[I] = Elt0->getSExtValue () * Elt1->getSExtValue ();
38483846 }
38493847 for (unsigned I = 0 ; I < Result.size (); I++) {
38503848 int32_t IAdd = MulVector[I * 2 ] + MulVector[I * 2 + 1 ];
Original file line number Diff line number Diff line change @@ -36,11 +36,7 @@ define <4 x i32> @dot_doubly_negative() {
3636 ret <4 x i32 > %res
3737}
3838
39- ; This test checks for llvm's compliance on spec's wasm.dot's imul and iadd
40- ; Since the original number can only be i16::max == 2^15 - 1,
41- ; subsequent modulo of 2^32 of imul and iadd
42- ; should return the same result
43- ; 2*(2^15 - 1)^2 % 2^32 == 2*(2^15 - 1)^2
39+ ; Tests that i16 max signed values fit in i32
4440define <4 x i32 > @dot_follow_modulo_spec_1 () {
4541; CHECK-LABEL: define <4 x i32> @dot_follow_modulo_spec_1() {
4642; CHECK-NEXT: ret <4 x i32> <i32 2147352578, i32 0, i32 0, i32 0>
@@ -49,9 +45,7 @@ define <4 x i32> @dot_follow_modulo_spec_1() {
4945 ret <4 x i32 > %res
5046}
5147
52- ; This test checks for llvm's compliance on spec's wasm.dot's imul and iadd
53- ; 2*(- 2^15)^2 == 2^31, doesn't exceed 2^32 so we don't have to mod
54- ; wrapping around is -(2^31), still doesn't exceed 2^32
48+ ; Tests that i16 min signed values fit in i32
5549define <4 x i32 > @dot_follow_modulo_spec_2 () {
5650; CHECK-LABEL: define <4 x i32> @dot_follow_modulo_spec_2() {
5751; CHECK-NEXT: ret <4 x i32> <i32 -2147483648, i32 0, i32 0, i32 0>
You can’t perform that action at this time.
0 commit comments