Question about i386.md and 32-bit and 64-bit split and peephole rules
Uros Bizjak
ubizjak@gmail.com
Mon Jun 2 21:00:00 GMT 2008
Hello!
> As I noticed are some parts in i386.md existing for just for 32-bit,
> but will be used in 64-bit, too.
>
> For example:
>
> (define_split
> [(set (match_operand:XF 0 "push_operand" "")
> (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
> ""
> [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 2)))
> (set (mem:XF (reg:SI SP_REG)) (float_extend:XF (match_dup 1)))]
> "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
>
> (define_split
> [(set (match_operand:XF 0 "push_operand" "")
> (float_extend:XF (match_operand:SF 1 "fp_register_operand" "")))]
> "TARGET_64BIT"
> [(set (reg:DI SP_REG) (plus:DI (reg:DI SP_REG) (match_dup 2)))
> (set (mem:DF (reg:DI SP_REG)) (float_extend:XF (match_dup 1)))]
> "operands[2] = GEN_INT (TARGET_128BIT_LONG_DOUBLE ? -16 : -12);")
>
> The first section will be used on 32-bit and on 64-bit, the second
> just for 64-bit. Isn't this wrong? Should in the first define_split
> not explicit said "!TARGET_64BIT"?
> There some other places where this happens too, and for the ESP
> adjustments there seems to be present just the 32-bit version?.
>
This is wrong, the first splitter should have !TARGET_64BIT. Even better
approach would be to copy what MIPS does:
;; This mode iterator allows :P to be used for patterns that operate on
;; pointer-sized quantities. Exactly one of the two alternatives will
match.
(define_mode_iterator P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
and use P iterator instead of SI and DI in one macroized pattern that
substitutes both splitters.
Uros.
More information about the Gcc
mailing list