i386.md (FRNDINT_ROUNDING): New int iterator.

* config/i386/i386.md (FRNDINT_ROUNDING): New int iterator.
	(rounding): New int attribute.
	(ROUNDING): Ditto.
	(frndintxf2_<rounding>): Macroize insn from
	frndintxf2_{floor,ceil,trunc} using FRNDINT_ROUNDING int iterator.
	(frndintxf2_<rounding>_i387): Macroize insn from
	frndintxf2_{floor,ceil,trunc}_i387 using FRNDINT_ROUNDING int iterator.

From-SVN: r188783
This commit is contained in:
Uros Bizjak 2012-06-19 18:32:57 +02:00
parent d35d1c0fee
commit b13024e6ad
2 changed files with 38 additions and 91 deletions

View File

@ -1,3 +1,13 @@
2012-06-19 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.md (FRNDINT_ROUNDING): New int iterator.
(rounding): New int attribute.
(ROUNDING): Ditto.
(frndintxf2_<rounding>): Macroize insn from
frndintxf2_{floor,ceil,trunc} using FRNDINT_ROUNDING int iterator.
(frndintxf2_<rounding>_i387): Macroize insn from
frndintxf2_{floor,ceil,trunc}_i387 using FRNDINT_ROUNDING int iterator.
2012-06-19 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (union_ranges): New function.
@ -335,7 +345,7 @@
PR c++/51033
* c-typeck.c (c_build_vec_perm_expr): Move to c-family/c-common.c.
* c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
* c-tree.h (c_build_vec_perm_expr): Move to c-family/c-common.h.
2012-06-15 Georg-Johann Lay <avr@gjlay.de>

View File

@ -15099,11 +15099,26 @@
DONE;
})
(define_int_iterator FRNDINT_ROUNDING
[UNSPEC_FRNDINT_FLOOR
UNSPEC_FRNDINT_CEIL
UNSPEC_FRNDINT_TRUNC])
(define_int_attr rounding
[(UNSPEC_FRNDINT_FLOOR "floor")
(UNSPEC_FRNDINT_CEIL "ceil")
(UNSPEC_FRNDINT_TRUNC "trunc")])
(define_int_attr ROUNDING
[(UNSPEC_FRNDINT_FLOOR "FLOOR")
(UNSPEC_FRNDINT_CEIL "CEIL")
(UNSPEC_FRNDINT_TRUNC "TRUNC")])
;; Rounding mode control word calculation could clobber FLAGS_REG.
(define_insn_and_split "frndintxf2_floor"
(define_insn_and_split "frndintxf2_<rounding>"
[(set (match_operand:XF 0 "register_operand")
(unspec:XF [(match_operand:XF 1 "register_operand")]
UNSPEC_FRNDINT_FLOOR))
FRNDINT_ROUNDING))
(clobber (reg:CC FLAGS_REG))]
"TARGET_USE_FANCY_MATH_387
&& flag_unsafe_math_optimizations
@ -15112,30 +15127,30 @@
"&& 1"
[(const_int 0)]
{
ix86_optimize_mode_switching[I387_FLOOR] = 1;
ix86_optimize_mode_switching[I387_<ROUNDING>] = 1;
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED);
operands[3] = assign_386_stack_local (HImode, SLOT_CW_FLOOR);
operands[3] = assign_386_stack_local (HImode, SLOT_CW_<ROUNDING>);
emit_insn (gen_frndintxf2_floor_i387 (operands[0], operands[1],
operands[2], operands[3]));
emit_insn (gen_frndintxf2_<rounding>_i387 (operands[0], operands[1],
operands[2], operands[3]));
DONE;
}
[(set_attr "type" "frndint")
(set_attr "i387_cw" "floor")
(set_attr "i387_cw" "<rounding>")
(set_attr "mode" "XF")])
(define_insn "frndintxf2_floor_i387"
(define_insn "frndintxf2_<rounding>_i387"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 1 "register_operand" "0")]
UNSPEC_FRNDINT_FLOOR))
FRNDINT_ROUNDING))
(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"
"fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
[(set_attr "type" "frndint")
(set_attr "i387_cw" "floor")
(set_attr "i387_cw" "<rounding>")
(set_attr "mode" "XF")])
(define_expand "floorxf2"
@ -15357,45 +15372,6 @@
DONE;
})
;; Rounding mode control word calculation could clobber FLAGS_REG.
(define_insn_and_split "frndintxf2_ceil"
[(set (match_operand:XF 0 "register_operand")
(unspec:XF [(match_operand:XF 1 "register_operand")]
UNSPEC_FRNDINT_CEIL))
(clobber (reg:CC FLAGS_REG))]
"TARGET_USE_FANCY_MATH_387
&& flag_unsafe_math_optimizations
&& can_create_pseudo_p ()"
"#"
"&& 1"
[(const_int 0)]
{
ix86_optimize_mode_switching[I387_CEIL] = 1;
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED);
operands[3] = assign_386_stack_local (HImode, SLOT_CW_CEIL);
emit_insn (gen_frndintxf2_ceil_i387 (operands[0], operands[1],
operands[2], operands[3]));
DONE;
}
[(set_attr "type" "frndint")
(set_attr "i387_cw" "ceil")
(set_attr "mode" "XF")])
(define_insn "frndintxf2_ceil_i387"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 1 "register_operand" "0")]
UNSPEC_FRNDINT_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"
"fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
[(set_attr "type" "frndint")
(set_attr "i387_cw" "ceil")
(set_attr "mode" "XF")])
(define_expand "ceilxf2"
[(use (match_operand:XF 0 "register_operand"))
(use (match_operand:XF 1 "register_operand"))]
@ -15613,45 +15589,6 @@
DONE;
})
;; Rounding mode control word calculation could clobber FLAGS_REG.
(define_insn_and_split "frndintxf2_trunc"
[(set (match_operand:XF 0 "register_operand")
(unspec:XF [(match_operand:XF 1 "register_operand")]
UNSPEC_FRNDINT_TRUNC))
(clobber (reg:CC FLAGS_REG))]
"TARGET_USE_FANCY_MATH_387
&& flag_unsafe_math_optimizations
&& can_create_pseudo_p ()"
"#"
"&& 1"
[(const_int 0)]
{
ix86_optimize_mode_switching[I387_TRUNC] = 1;
operands[2] = assign_386_stack_local (HImode, SLOT_CW_STORED);
operands[3] = assign_386_stack_local (HImode, SLOT_CW_TRUNC);
emit_insn (gen_frndintxf2_trunc_i387 (operands[0], operands[1],
operands[2], operands[3]));
DONE;
}
[(set_attr "type" "frndint")
(set_attr "i387_cw" "trunc")
(set_attr "mode" "XF")])
(define_insn "frndintxf2_trunc_i387"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 1 "register_operand" "0")]
UNSPEC_FRNDINT_TRUNC))
(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"
"fldcw\t%3\n\tfrndint\n\tfldcw\t%2"
[(set_attr "type" "frndint")
(set_attr "i387_cw" "trunc")
(set_attr "mode" "XF")])
(define_expand "btruncxf2"
[(use (match_operand:XF 0 "register_operand"))
(use (match_operand:XF 1 "register_operand"))]
@ -15708,7 +15645,7 @@
(define_insn_and_split "frndintxf2_mask_pm"
[(set (match_operand:XF 0 "register_operand")
(unspec:XF [(match_operand:XF 1 "register_operand")]
UNSPEC_FRNDINT_MASK_PM))
UNSPEC_FRNDINT_MASK_PM))
(clobber (reg:CC FLAGS_REG))]
"TARGET_USE_FANCY_MATH_387
&& flag_unsafe_math_optimizations
@ -15733,7 +15670,7 @@
(define_insn "frndintxf2_mask_pm_i387"
[(set (match_operand:XF 0 "register_operand" "=f")
(unspec:XF [(match_operand:XF 1 "register_operand" "0")]
UNSPEC_FRNDINT_MASK_PM))
UNSPEC_FRNDINT_MASK_PM))
(use (match_operand:HI 2 "memory_operand" "m"))
(use (match_operand:HI 3 "memory_operand" "m"))]
"TARGET_USE_FANCY_MATH_387