https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125134
Bug ID: 125134
Summary: pr116896.c fails with --enable-default-pie
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: xry111 at gcc dot gnu.org
Target Milestone: ---
With -fpie, pr116896.c:
/* { dg-options "-O2 -masm=att -fno-stack-protector -mtune=generic" } */
signed char
foo (float x, float y)
{
if (x == y)
return 0;
else if (x < y)
return -1;
else if (x > y)
return 1;
else
return 2;
}
is compiled to
foo:
xorl %eax, %eax
comiss %xmm1, %xmm0
jp .L2
seta %al
sbbl $0, %eax
ret
But with -fpie:
foo:
xorl %eax, %eax
comiss %xmm1, %xmm0
movl $2, %edx
seta %al
sbbl $0, %eax
ucomiss %xmm1, %xmm0
cmovp %edx, %eax
ret
It seems similar to PR122503 but I cannot see why setting -fpie should affect
the cost model of conditional move.