RFR: 8297753: AArch64: Add optimized rules for vector compare with zero on NEON [v6]

Chang Peng duke at openjdk.org
Mon Feb 27 08:59:08 UTC 2023


On Mon, 27 Feb 2023 08:44:10 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Thanks, I think this assert will guarantee the correctness of this function.
>> 
>> I found that cmpOpUOper convert signed BoolTest conditions (gt, ge, lt, le) to unsigned Assembler conditions, but unsigned vector comparison in vector API will produce unsigned BoolTest conditions(uge, ugt, ult, ule), and these conditons cannot be passed like following:
>> 
>> 
>> assert(cmpOpUOper(unsigned_cond).ccode() == result, "Invalid conversion");
>> ``` 
>> Maybe we will meet some issues when taking unsigned vector comparison.
>
> I see. That sounds like a bug, but OK.

Following is the code of ccode() of cmpOpUOper:


virtual int ccode() const { 
    switch (_c0) {
    case  BoolTest::eq : return equal();
    case  BoolTest::gt : return greater();
    case  BoolTest::lt : return less();
    case  BoolTest::ne : return not_equal();
    case  BoolTest::le : return less_equal();
    case  BoolTest::ge : return greater_equal();
    case  BoolTest::overflow : return overflow();
    case  BoolTest::no_overflow: return no_overflow();
    default : ShouldNotReachHere(); return 0;
    }
  };


I have another patch working on enabling SVE vector unsigned comparison, if we use ```assert(cmpOpUOper(unsigned_cond).ccode() == result, "Invalid conversion");```, the code will enter 
```ShouldNotReachHere()```.

-------------

PR: https://git.openjdk.org/jdk/pull/11822


More information about the hotspot-compiler-dev mailing list