diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 1ec14c02a5887..266a5874cea86 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -2581,6 +2581,7 @@ static bool can_subword_truncate(Node* in, const Type* type) { switch (opc) { case Op_AbsI: case Op_DivI: + case Op_ModI: case Op_MinI: case Op_MaxI: case Op_CMoveI: diff --git a/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java b/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java index f355a0bf05f6c..5985367b26572 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestSubwordTruncation.java @@ -29,7 +29,7 @@ /* * @test - * @bug 8350177 + * @bug 8350177 8362171 * @summary Ensure that truncation of subword vectors produces correct results * @library /test/lib / * @run driver compiler.vectorization.TestSubwordTruncation @@ -376,6 +376,18 @@ public void checkTestByteBitCount(Object[] vals) { } } + int intField; + short shortField; + + @Test + @IR(counts = { IRNode.MOD_I, ">0" }) + public void testMod() { + for (int i = 1; i < SIZE; i++) { + for (int j = 1; j < 204; j++) { + shortField %= intField | 1; + } + } + } public static void main(String[] args) { TestFramework.run();