Skip to content

Commit bcf89f0

Browse files
committed
i386: Fix up expander conditions on cbranchbf4 and cstorebf4 [PR107969]
With -msoft-float we ICE on __bf16 comparisons, because the insns we want to use under the hood (cbranchsf4 and cstoresf4) after performing the fast extensions aren't available. The following patch copies the conditions from the c*sf4 expanders to the corresponding c*bf4 expanders. 2022-12-06 Jakub Jelinek <[email protected]> PR target/107969 * config/i386/i386.md (cbranchbf4, cstorebf4): Guard expanders with the same condition as cbranchsf4 or cstoresf4 expanders. * gcc.target/i386/pr107969.c: New test.
1 parent 8872df3 commit bcf89f0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

gcc/config/i386/i386.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@
16671667
(const_int 0)])
16681668
(label_ref (match_operand 3))
16691669
(pc)))]
1670-
""
1670+
"TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)"
16711671
{
16721672
rtx op1 = ix86_expand_fast_convert_bf_to_sf (operands[1]);
16731673
rtx op2 = ix86_expand_fast_convert_bf_to_sf (operands[2]);
@@ -1702,7 +1702,7 @@
17021702
(match_operator 1 "comparison_operator"
17031703
[(reg:CC FLAGS_REG)
17041704
(const_int 0)]))]
1705-
""
1705+
"TARGET_80387 || (SSE_FLOAT_MODE_P (SFmode) && TARGET_SSE_MATH)"
17061706
{
17071707
rtx op1 = ix86_expand_fast_convert_bf_to_sf (operands[2]);
17081708
rtx op2 = ix86_expand_fast_convert_bf_to_sf (operands[3]);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* PR target/107969 */
2+
/* { dg-do compile } */
3+
/* { dg-options "-O2 -fexcess-precision=16 -msoft-float -msse2" } */
4+
5+
int i;
6+
__bf16 f;
7+
8+
void
9+
bar (void)
10+
{
11+
i *= 0 <= f;
12+
}

0 commit comments

Comments
 (0)