[llvm] [PowerPC] simplify the asm of scmp builtin (PR #200024)
zhijian lin via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 07:53:15 PDT 2026
diggerlin wrote:
> basically my point is @diggerlin, I know that this is not entirely Legal, but given that it is just 2 instructions, can we have the setb version be in legal?
In my patch, I customized scmp when Subtarget.isISA3_0() is false. When Subtarget.isISA3_0() is true, it simply returns SDValue(), as shown below:
```
if (Subtarget.isISA3_0())
return SDValue();
```
In your patch ([PR #206282](https://github.com/llvm/llvm-project/pull/206282/changes#top)), you only handle scmp when Subtarget.isISA3_0() is true. I prefer to keep all custom handling for Subtarget.isISA3_0() as well, rather than legalizing scmp. Also, I'm not sure what optimizations your patch introduces. (do I miss something?)
Note that even without your patch, scmp_8_8 already generates the same assembly for Power9+:
```
; AIX64-PWR9-LABEL: scmp_8_8:
; AIX64-PWR9: # %bb.0:
; AIX64-PWR9-NEXT: cmpw 3, 4
; AIX64-PWR9-NEXT: setb 3, 0
; AIX64-PWR9-NEXT: blr
```
https://github.com/llvm/llvm-project/pull/200024
More information about the llvm-commits
mailing list