Re: [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR

2021-11-11 Thread Philipp Tomsich
Kito, Thanks for the reality-check: the subreg-expressions are getting in the way. I'll drop this from v2, as a permanent resolution for this will be a bit more involved. Philipp. On Thu, 11 Nov 2021 at 17:42, Kito Cheng wrote: > > Hi Philipp: > > This testcase got wrong result with this patch

Re: [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR

2021-11-11 Thread Kito Cheng via Gcc-patches
Hi Philipp: This testcase got wrong result with this patch even w/o si3_sext pattern: #include #define MAX(A, B) ((A) > (B) ? (A) : (B)) long long __attribute__((noinline, noipa)) foo6(long long a, long long b, int c) { int xa = a; int xb = b; return MAX(MAX(xa, xb), c); } int main() {

Re: [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR

2021-11-11 Thread Kito Cheng via Gcc-patches
IIRC it's not work even without sign extend pattern since I did similar experimental before (not for RISC-V, but same concept), I guess I need more time to test that. Philipp Tomsich 於 2021年11月12日 週五 00:18 寫道: > Kito, > > Unless I am missing something, the problem is not the relaxation to > GPR,

Re: [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR

2021-11-11 Thread Philipp Tomsich
Kito, Unless I am missing something, the problem is not the relaxation to GPR, but rather the sign-extending pattern I had squashed into the same patch. If you disable "si3_sext", a sext.w will be have to be emitted after the 'max' and before the return (or before the SImode output is consumed as

Re: [PATCH v1 8/8] RISC-V: bitmanip: relax minmax to operate on GPR

2021-11-11 Thread Kito Cheng via Gcc-patches
Hi Philipp: We can't pretend we have SImode min/max instruction without that semantic. Give this testcase, x86 and rv64gc print out 8589934592 8589934591 = 0, but with this patch and compile with rv64gc_zba_zbb -O3, the output become 8589934592 8589934591 = 8589934592 -Testcase---