[PATCH] D152538: `G_ATOMICRMW_NAND` failure in legalizer

niwin anto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 09:58:15 PDT 2023


niwinanto added a comment.

In D152538#4409242 <https://reviews.llvm.org/D152538#4409242>, @arsenm wrote:

> In D152538#4409230 <https://reviews.llvm.org/D152538#4409230>, @niwinanto wrote:
>
>> In D152538#4409120 <https://reviews.llvm.org/D152538#4409120>, @arsenm wrote:
>>
>>> In D152538#4409114 <https://reviews.llvm.org/D152538#4409114>, @niwinanto wrote:
>>>
>>>> In D152538#4408800 <https://reviews.llvm.org/D152538#4408800>, @arsenm wrote:
>>>>
>>>>> Needs testcase
>>>>
>>>> I am not sure how to trigger this error.  I don't see any targets legalizing G_ATOMICRMW_NAND. Only AMD GPU has G_ATOMICRMW_NAND in legalizerInfo, but it is lowered. In our use case we are legalizing it and facing this issue.
>>>
>>> You didn't post any patch context so I'm not sure what you're specifically handling here. You just need a mir test with G_ATOMICRMW_NAND and/or an IR test with atomicrmw nand with the appropriate type
>>
>> Apologies, I could not explain correctly.
>>
>> For example
>>
>>   %0 = atomicrmw nand ptr @sc, i8 1 seq_cst, align 1
>>
>> to
>>
>>   %0:_(s8) = G_ATOMICRMW_NAND %1(p0), %2 :: (load store seq_cst (s8) on @s    c)
>>
>> In our use case, s8 for G_ATOMICRMW_NAND is not supported. Hence, trying to widen it to s32.
>> However, `LegalizerHelper::widenScalar(...)` does not handle G_ATOMICRMW_NAND, but other G_ATOMICRMW*.
>>
>> Why I cannot add test/ trigger this error, no other target legalize G_ATOMICRMW_NAND, hence I cannot invoke `LegalizerHelper::widenScalar(...)`.
>
> I think ppc or mips would use this, plus there's always unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp

I was not aware of `unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp` let me have a look at this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152538/new/

https://reviews.llvm.org/D152538



More information about the llvm-commits mailing list