This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix for x86-64
- From: Jan Hubicka <jh at suse dot cz>
- To: Bo Thorsen <bo at sonofthor dot dk>
- Cc: gcc-patches at gcc dot gnu dot org, patches at x86-64 dot org
- Date: Thu, 10 Jan 2002 11:31:19 +0100
- Subject: Re: Fix for x86-64
- References: <20020110102653.521B812C501@pluto.sonofthor.dk>
> This testcase:
>
> --- mpbande.i ---:
> float f();
> int b();
>
> int problem(void)
> {
> if(b()) {
> float val, lo = f(), hi = f();
>
> if(val = hi >= 1 ? hi : lo <= -1 ? lo : 0.0)
> {f();};
> }
> }
> --- *** ----
>
> gives this ICE in x86-64 compilation:
>
> bo@pluto:/tmp> /home/bo/Work/crossbuild/x86-64/bin/x86_64-unknown-linux-gcc
> -mcmodel=medium -O2 mpbande.i
> mpbande.i: In function `problem':
> mpbande.i:12: could not split insn
> (insn 122 159 68 (set (reg/v:SF 22 exmm1 [60])
> (if_then_else:SF (ungt (reg/v:SF 22 exmm1 [60])
> (reg:SF 23 exmm2))
> (reg:SF 21 exmm0)
> (reg/v:SF 3 ebx [61]))) 642 {*sse_movsfcc_const0_2} (insn_list
> 159 (insn_list 153 (insn_list 150 (nil))))
> (expr_list:REG_DEAD (reg:SF 23 exmm2)
> (expr_list:REG_DEAD (reg:SF 21 exmm0)
> (expr_list:REG_DEAD (reg/v:SF 3 ebx [61])
> (nil)))))
> mpbande.i:12: Internal compiler error in final_scan_insn, at final.c:2627
>
> This only happens with both -mcmodel=medium and -O2.
>
> The following patch cures this problem, but Honza should comment on wether
> the conditional moves actually can be used with the medium memory model.
Yes, they should be used. I am not quite sure how the invalid instruction is
created, but I will check it today.
I am going to test the attached patch and install it as obvious bugfix if
it passes. THe constraints are messed up.
Thu Jan 10 11:29:55 CET 2002 Jan Hubicka <jh@suse.cz>
* i386.md (sse_mov?fcc_const0_?): Fix constraints.
Index: i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.326
diff -c -3 -p -r1.326 i386.md
*** i386.md 2002/01/10 10:21:30 1.326
--- i386.md 2002/01/10 10:28:51
***************
*** 16508,16515 ****
(if_then_else:SF (match_operator 1 "sse_comparison_operator"
[(match_operand:SF 4 "register_operand" "0")
(match_operand:SF 5 "nonimmediate_operand" "xm")])
! (match_operand:SF 2 "const0_operand" "x")
! (match_operand:SF 3 "register_operand" "X")))]
"TARGET_SSE"
"#")
--- 16508,16515 ----
(if_then_else:SF (match_operator 1 "sse_comparison_operator"
[(match_operand:SF 4 "register_operand" "0")
(match_operand:SF 5 "nonimmediate_operand" "xm")])
! (match_operand:SF 2 "const0_operand" "X")
! (match_operand:SF 3 "register_operand" "x")))]
"TARGET_SSE"
"#")
***************
*** 16528,16535 ****
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(match_operand:SF 4 "nonimmediate_operand" "xm")
(match_operand:SF 5 "register_operand" "0")])
! (match_operand:SF 2 "const0_operand" "x")
! (match_operand:SF 3 "register_operand" "X")))]
"TARGET_SSE"
"#")
--- 16528,16535 ----
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(match_operand:SF 4 "nonimmediate_operand" "xm")
(match_operand:SF 5 "register_operand" "0")])
! (match_operand:SF 2 "const0_operand" "X")
! (match_operand:SF 3 "register_operand" "x")))]
"TARGET_SSE"
"#")
***************
*** 16548,16555 ****
(if_then_else:SF (match_operator 1 "sse_comparison_operator"
[(match_operand:SF 4 "register_operand" "0")
(match_operand:SF 5 "nonimmediate_operand" "xm")])
! (match_operand:SF 2 "const0_operand" "x")
! (match_operand:SF 3 "register_operand" "X")))]
"TARGET_SSE2"
"#")
--- 16548,16555 ----
(if_then_else:SF (match_operator 1 "sse_comparison_operator"
[(match_operand:SF 4 "register_operand" "0")
(match_operand:SF 5 "nonimmediate_operand" "xm")])
! (match_operand:SF 2 "const0_operand" "X")
! (match_operand:SF 3 "register_operand" "x")))]
"TARGET_SSE2"
"#")
***************
*** 16568,16575 ****
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(match_operand:SF 4 "nonimmediate_operand" "xm")
(match_operand:SF 5 "register_operand" "0")])
! (match_operand:SF 2 "const0_operand" "x")
! (match_operand:SF 3 "register_operand" "X")))]
"TARGET_SSE2"
"#")
--- 16568,16575 ----
(if_then_else:SF (match_operator 1 "fcmov_comparison_operator"
[(match_operand:SF 4 "nonimmediate_operand" "xm")
(match_operand:SF 5 "register_operand" "0")])
! (match_operand:SF 2 "const0_operand" "X")
! (match_operand:SF 3 "register_operand" "x")))]
"TARGET_SSE2"
"#")