RFR: 8291809: Convert compiler/c2/cr7200264/TestSSE2IntVect.java to IR verification test [v2]
Daniel Lundén
dlunden at openjdk.org
Wed Jan 24 13:05:52 UTC 2024
On Thu, 18 Jan 2024 12:24:42 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Daniel Lundén has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Refactor test to use multiple @Test
>
> Well, I think at least some of the `shift` examples should also vectorize:
> `./java -XX:CompileCommand=compileonly,Test::test1 -XX:+TraceSuperWord -XX:+TraceLoopOpts -XX:+TraceNewVectors -XX:UseAVX=2 Test.java`
>
> Not sure if for all SSE and AVX levels, but all that I quickly checked with the UseSSE and USEAVX flags.
>
>
> TraceNewVectors [SuperWord]: 832 LoadVector === 347 766 740 [[ 738 734 731 727 619 616 518 136 ]] @int[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; mismatched #vectory[8]:{int} !orig=[739],[620],[519],[135] !jvms: Test::test2 @ bci:12 (line 21)
> TraceNewVectors [SuperWord]: 836 LShiftVI === _ 832 835 [[ 736 733 730 725 618 615 516 157 ]] #vectory[8]:{int} !orig=[738],[619],[518],[136] !jvms: Test::test2 @ bci:14 (line 21)
> TraceNewVectors [SuperWord]: 837 StoreVector === 763 766 737 836 [[ 341 766 160 339 ]] @int[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; mismatched Memory: @int[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact+any *, idx=5; !orig=[736],[618],[516],[157],535 !jvms: Test::test2 @ bci:15 (line 21)
>
>
> Test.java:
>
> public class Test {
> static int RANGE = 10_000;
>
> public static void main(String[] args) {
> int[] a = new int[RANGE];
> int[] b = new int[RANGE];
> for (int i = 0; i < 10_000; i++) {
> test1(a, b);
> test2(a, b, i % 200 - 100);
> }
> }
>
> static void test1(int[] a, int[] b) {
> for (int i = 0; i < a.length; i++) {
> a[i] = (int)(b[i] << 32);
> }
> }
>
> static void test2(int[] a, int[] b, int s) {
> for (int i = 0; i < a.length; i++) {
> a[i] = (int)(b[i] << s);
> }
> }
> }
>
>
> I also found this test in `test/hotspot/jtreg/compiler/vectorization/runner/BasicIntOpTest.java`:
>
> @Test
> @IR(applyIfCPUFeatureOr = {"asimd", "true", "sse2", "true"},
> counts = {IRNode.LSHIFT_VI, ">0"})
> public int[] vectorShiftLeft() {
> int[] res = new int[SIZE];
> for (int i = 0; i < SIZE; i++) {
> res[i] = a[i] << 3;
> }
> return res;
> }
>
>
> Plus, I see `test.addExpectedVectorization("LShiftVI", 5);` in `test/hotspot/jtreg/compiler/c2/cr7200264/TestSSE2IntVect.java`, which you now deleted.
>
> @dlunde would you mind investigating a bit more if you can add some IR rules for all (or at least a few) of the shift examples?
> If you think they really do not vectorize, can you paste me a Test.java with comm...
Thanks @eme64. I've addressed all comments now; please have a look again.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17428#issuecomment-1908081925
More information about the hotspot-compiler-dev
mailing list