On 12/30/25 8:41 PM, Jeffrey Law wrote:
On 12/30/2025 6:29 AM, Daniel Barboza wrote:
Add a pattern to handle cases where we have an OP that is
unconditionally being applied in the result of a gcond. In this case we
can apply OP to both legs of the conditional. E.g:
t = b ? 10 : 20;
t = t + 20;
becomes just:
t = b ? 30 : 40
A variant pattern was also added to handle the case where the gcond
result is used as the second operand. This was needed because most of
the ops we're handling aren't commutative.
PR 122608
gcc/ChangeLog:
* match.pd (`(c ? a : b) op d -> c ? (a op d) : (b op d)`): New
pattern.
(`d op (c ? a : b) -> c ? (d op a) : (d op b)`): Likewise
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr110701.c: the pattern added is now folding
an XOR into the ifcond and the assembler isn't emitting an
'andl' anymore. The test was turned into a runtime test
instead.
* gcc.dg/torture/pr122608.c: New test.
OK. So one thing did pop from that test. On xstormy16-elf I'm seeing:
/home/jlaw/jenkins/workspace/xstormy16-elf/gcc/gcc/testsuite/gcc.dg/torture/pr122608.c:
In function 'mulhighpart_test':
/home/jlaw/jenkins/workspace/xstormy16-elf/gcc/gcc/testsuite/gcc.dg/torture/pr122608.c:151:1:
error: type mismatch in binary expression
int
int
long int
t = t h* 2147483647;
With a similar error in mulhighpart_test2. It's saying we have an integer
output (t), integer input (t) and long integer input (2147483647). Not sure
how we got long int type here. But it's clearly unhappy.
Seems like xstormy16 is a 16 bit target and the literal I'm using in
the test (2147483647, or 0x7fffffff) is a long int in that context.
I guess we should use something like (UINT_MAX >> 1) instead of 0x7fffffff.
I'll see if I can reproduce this error with xstormy16 and if the macro
fixes the problem.
Thanks,
Daniel
Jeff