mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
reg-stack.c (subst_stack_regs_pat): Handle <UNSPEC_FIST_FLOOR> and <UNSPEC_FIST_CEIL> case.
* reg-stack.c (subst_stack_regs_pat): Handle <UNSPEC_FIST_FLOOR> and <UNSPEC_FIST_CEIL> case. * config/i386/i386.md (UNSPEC_FIST_FLOOR, UNSPEC_FIST_CEIL): New. (*fist<mode>2_floor_1, fistdi2_floor, fistdi2_floor_with_temp) (fist<mode>2_floor, fist<mode>2_floor_with_temp): New isns patterns to implement lfloor and llfloor built-ins as x87 intrinsic function. (fistdi2_floor, fist<mode>2_floor splitters): New splitters. (lfloor<mode>2): New expanders. (*fist<mode>2_ceil_1, fistdi2_ceil, fistdi2_ceil_with_temp) (fist<mode>2_ceil, fist<mode>2_ceil_with_temp): New isns patterns to implement lceil and llceil built-ins as x87 intrinsic function. (fistdi2_ceil, fist<mode>2_ceil splitters): New splitters. (lceil<mode>2): New expanders. From-SVN: r98132
This commit is contained in:
parent
2ec76fdb24
commit
4a92766451
@ -1,3 +1,20 @@
|
||||
2005-04-14 Uros Bizjak <uros@kss-loka.si>
|
||||
|
||||
* reg-stack.c (subst_stack_regs_pat): Handle <UNSPEC_FIST_FLOOR> and
|
||||
<UNSPEC_FIST_CEIL> case.
|
||||
|
||||
* config/i386/i386.md (UNSPEC_FIST_FLOOR, UNSPEC_FIST_CEIL): New.
|
||||
(*fist<mode>2_floor_1, fistdi2_floor, fistdi2_floor_with_temp)
|
||||
(fist<mode>2_floor, fist<mode>2_floor_with_temp): New isns patterns
|
||||
to implement lfloor and llfloor built-ins as x87 intrinsic function.
|
||||
(fistdi2_floor, fist<mode>2_floor splitters): New splitters.
|
||||
(lfloor<mode>2): New expanders.
|
||||
(*fist<mode>2_ceil_1, fistdi2_ceil, fistdi2_ceil_with_temp)
|
||||
(fist<mode>2_ceil, fist<mode>2_ceil_with_temp): New isns patterns
|
||||
to implement lceil and llceil built-ins as x87 intrinsic function.
|
||||
(fistdi2_ceil, fist<mode>2_ceil splitters): New splitters.
|
||||
(lceil<mode>2): New expanders.
|
||||
|
||||
2005-04-14 Uros Bizjak <uros@kss-loka.si>
|
||||
|
||||
* convert.c (convert_to_integer): Convert (long int)trunc{,f,l},
|
||||
|
@ -122,6 +122,8 @@
|
||||
(UNSPEC_FRNDINT_CEIL 71)
|
||||
(UNSPEC_FRNDINT_TRUNC 72)
|
||||
(UNSPEC_FRNDINT_MASK_PM 73)
|
||||
(UNSPEC_FIST_FLOOR 74)
|
||||
(UNSPEC_FIST_CEIL 75)
|
||||
|
||||
; x87 Double output FP
|
||||
(UNSPEC_SINCOS_COS 80)
|
||||
@ -16435,6 +16437,163 @@
|
||||
DONE;
|
||||
})
|
||||
|
||||
(define_insn_and_split "*fist<mode>2_floor_1"
|
||||
[(set (match_operand:X87MODEI 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:X87MODEI [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations
|
||||
&& !(reload_completed || reload_in_progress)"
|
||||
"#"
|
||||
"&& 1"
|
||||
[(const_int 0)]
|
||||
{
|
||||
ix86_optimize_mode_switching = 1;
|
||||
operands[2] = assign_386_stack_local (HImode, 1);
|
||||
operands[3] = assign_386_stack_local (HImode, 2);
|
||||
if (memory_operand (operands[0], VOIDmode))
|
||||
emit_insn (gen_fist<mode>2_floor (operands[0], operands[1],
|
||||
operands[2], operands[3]));
|
||||
else
|
||||
{
|
||||
operands[4] = assign_386_stack_local (<MODE>mode, 0);
|
||||
emit_insn (gen_fist<mode>2_floor_with_temp (operands[0], operands[1],
|
||||
operands[2], operands[3],
|
||||
operands[4]));
|
||||
}
|
||||
DONE;
|
||||
}
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "floor")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_insn "fistdi2_floor"
|
||||
[(set (match_operand:DI 0 "memory_operand" "=m")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "f")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" "m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m"))
|
||||
(clobber (match_scratch:XF 4 "=&1f"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"* return output_fix_trunc (insn, operands, 0);"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "floor")
|
||||
(set_attr "mode" "DI")])
|
||||
|
||||
(define_insn "fistdi2_floor_with_temp"
|
||||
[(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" "m,m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m,m"))
|
||||
(clobber (match_operand:DI 4 "memory_operand" "=m,m"))
|
||||
(clobber (match_scratch:XF 5 "=&1f,&1f"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"#"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "floor")
|
||||
(set_attr "mode" "DI")])
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:DI 0 "register_operand" "")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:DI 4 "memory_operand" ""))
|
||||
(clobber (match_scratch 5 ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 4) (unspec:DI [(match_dup 1)] UNSPEC_FIST_FLOOR))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))
|
||||
(clobber (match_dup 5))])
|
||||
(set (match_dup 0) (match_dup 4))]
|
||||
"")
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:DI 0 "memory_operand" "")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:DI 4 "memory_operand" ""))
|
||||
(clobber (match_scratch 5 ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_FIST_FLOOR))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))
|
||||
(clobber (match_dup 5))])]
|
||||
"")
|
||||
|
||||
(define_insn "fist<mode>2_floor"
|
||||
[(set (match_operand:X87MODEI12 0 "memory_operand" "=m")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "f")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" "m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"* return output_fix_trunc (insn, operands, 0);"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "floor")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_insn "fist<mode>2_floor_with_temp"
|
||||
[(set (match_operand:X87MODEI12 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" "m,m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m,m"))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" "=m,m"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"#"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "floor")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:X87MODEI12 0 "register_operand" "")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 4) (unspec:X87MODEI12 [(match_dup 1)]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))])
|
||||
(set (match_dup 0) (match_dup 4))]
|
||||
"")
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:X87MODEI12 0 "memory_operand" "")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 0) (unspec:X87MODEI12 [(match_dup 1)]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))])]
|
||||
"")
|
||||
|
||||
(define_expand "lfloor<mode>2"
|
||||
[(parallel [(set (match_operand:X87MODEI 0 "nonimmediate_operand" "")
|
||||
(unspec:X87MODEI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_FLOOR))
|
||||
(clobber (reg:CC FLAGS_REG))])]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"")
|
||||
|
||||
;; Rounding mode control word calculation could clobber FLAGS_REG.
|
||||
(define_insn_and_split "frndintxf2_ceil"
|
||||
[(set (match_operand:XF 0 "register_operand" "=f")
|
||||
@ -16518,6 +16677,163 @@
|
||||
DONE;
|
||||
})
|
||||
|
||||
(define_insn_and_split "*fist<mode>2_ceil_1"
|
||||
[(set (match_operand:X87MODEI 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:X87MODEI [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations
|
||||
&& !(reload_completed || reload_in_progress)"
|
||||
"#"
|
||||
"&& 1"
|
||||
[(const_int 0)]
|
||||
{
|
||||
ix86_optimize_mode_switching = 1;
|
||||
operands[2] = assign_386_stack_local (HImode, 1);
|
||||
operands[3] = assign_386_stack_local (HImode, 2);
|
||||
if (memory_operand (operands[0], VOIDmode))
|
||||
emit_insn (gen_fist<mode>2_ceil (operands[0], operands[1],
|
||||
operands[2], operands[3]));
|
||||
else
|
||||
{
|
||||
operands[4] = assign_386_stack_local (<MODE>mode, 0);
|
||||
emit_insn (gen_fist<mode>2_ceil_with_temp (operands[0], operands[1],
|
||||
operands[2], operands[3],
|
||||
operands[4]));
|
||||
}
|
||||
DONE;
|
||||
}
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "ceil")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_insn "fistdi2_ceil"
|
||||
[(set (match_operand:DI 0 "memory_operand" "=m")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "f")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" "m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m"))
|
||||
(clobber (match_scratch:XF 4 "=&1f"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"* return output_fix_trunc (insn, operands, 0);"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "ceil")
|
||||
(set_attr "mode" "DI")])
|
||||
|
||||
(define_insn "fistdi2_ceil_with_temp"
|
||||
[(set (match_operand:DI 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" "m,m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m,m"))
|
||||
(clobber (match_operand:DI 4 "memory_operand" "=m,m"))
|
||||
(clobber (match_scratch:XF 5 "=&1f,&1f"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"#"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "ceil")
|
||||
(set_attr "mode" "DI")])
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:DI 0 "register_operand" "")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:DI 4 "memory_operand" ""))
|
||||
(clobber (match_scratch 5 ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 4) (unspec:DI [(match_dup 1)] UNSPEC_FIST_CEIL))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))
|
||||
(clobber (match_dup 5))])
|
||||
(set (match_dup 0) (match_dup 4))]
|
||||
"")
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:DI 0 "memory_operand" "")
|
||||
(unspec:DI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:DI 4 "memory_operand" ""))
|
||||
(clobber (match_scratch 5 ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 0) (unspec:DI [(match_dup 1)] UNSPEC_FIST_CEIL))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))
|
||||
(clobber (match_dup 5))])]
|
||||
"")
|
||||
|
||||
(define_insn "fist<mode>2_ceil"
|
||||
[(set (match_operand:X87MODEI12 0 "memory_operand" "=m")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "f")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" "m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"* return output_fix_trunc (insn, operands, 0);"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "ceil")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_insn "fist<mode>2_ceil_with_temp"
|
||||
[(set (match_operand:X87MODEI12 0 "nonimmediate_operand" "=m,?r")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "f,f")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" "m,m"))
|
||||
(use (match_operand:HI 3 "memory_operand" "m,m"))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" "=m,m"))]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"#"
|
||||
[(set_attr "type" "fistp")
|
||||
(set_attr "i387_cw" "ceil")
|
||||
(set_attr "mode" "<MODE>")])
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:X87MODEI12 0 "register_operand" "")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 4) (unspec:X87MODEI12 [(match_dup 1)]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))])
|
||||
(set (match_dup 0) (match_dup 4))]
|
||||
"")
|
||||
|
||||
(define_split
|
||||
[(set (match_operand:X87MODEI12 0 "memory_operand" "")
|
||||
(unspec:X87MODEI12 [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_operand:HI 2 "memory_operand" ""))
|
||||
(use (match_operand:HI 3 "memory_operand" ""))
|
||||
(clobber (match_operand:X87MODEI12 4 "memory_operand" ""))]
|
||||
"reload_completed"
|
||||
[(parallel [(set (match_dup 0) (unspec:X87MODEI12 [(match_dup 1)]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(use (match_dup 2))
|
||||
(use (match_dup 3))])]
|
||||
"")
|
||||
|
||||
(define_expand "lceil<mode>2"
|
||||
[(parallel [(set (match_operand:X87MODEI 0 "nonimmediate_operand" "")
|
||||
(unspec:X87MODEI [(match_operand:XF 1 "register_operand" "")]
|
||||
UNSPEC_FIST_CEIL))
|
||||
(clobber (reg:CC FLAGS_REG))])]
|
||||
"TARGET_USE_FANCY_MATH_387
|
||||
&& (!TARGET_SSE_MATH || TARGET_MIX_SSE_I387)
|
||||
&& flag_unsafe_math_optimizations"
|
||||
"")
|
||||
|
||||
;; Rounding mode control word calculation could clobber FLAGS_REG.
|
||||
(define_insn_and_split "frndintxf2_trunc"
|
||||
[(set (match_operand:XF 0 "register_operand" "=f")
|
||||
|
@ -1671,6 +1671,10 @@ subst_stack_regs_pat (rtx insn, stack regstack, rtx pat)
|
||||
switch (XINT (pat_src, 1))
|
||||
{
|
||||
case UNSPEC_FIST:
|
||||
|
||||
case UNSPEC_FIST_FLOOR:
|
||||
case UNSPEC_FIST_CEIL:
|
||||
|
||||
/* These insns only operate on the top of the stack. */
|
||||
|
||||
src1 = get_true_reg (&XVECEXP (pat_src, 0, 0));
|
||||
|
Loading…
Reference in New Issue
Block a user