Commit fea8f6c6 by Michael Collison Committed by Michael Collison

arm.md (*arm_smin_cmp): New pattern.

2015-08-01  Michael Collison  <michael.collison@linaro.org
	    Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>

	* gcc/config/arm/arm.md (*arm_smin_cmp): New pattern.
	(*arm_umin_cmp): Likewise.

	* gcc.target/arm/mincmp.c: New test.

From-SVN: r226476
parent b0cca5ec
2015-08-01 Michael Collison <michael.collison@linaro.org
Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
* gcc/config/arm/arm.md (*arm_smin_cmp): New pattern.
(*arm_umin_cmp): Likewise.
2015-08-01 Caroline Tice <cmtice@google.com>
PR 66521
......
......@@ -3455,6 +3455,44 @@
(set_attr "type" "multiple,multiple")]
)
;; t = (s/u)min (x, y)
;; cc = cmp (t, z)
;; is the same as
;; cmp x, z
;; cmpge(u) y, z
(define_insn_and_split "*arm_smin_cmp"
[(set (reg:CC CC_REGNUM)
(compare:CC
(smin:SI (match_operand:SI 0 "s_register_operand" "r")
(match_operand:SI 1 "s_register_operand" "r"))
(match_operand:SI 2 "s_register_operand" "r")))]
"TARGET_32BIT"
"#"
"&& reload_completed"
[(set (reg:CC CC_REGNUM)
(compare:CC (match_dup 0) (match_dup 2)))
(cond_exec (ge:CC (reg:CC CC_REGNUM) (const_int 0))
(set (reg:CC CC_REGNUM)
(compare:CC (match_dup 1) (match_dup 2))))]
)
(define_insn_and_split "*arm_umin_cmp"
[(set (reg:CC CC_REGNUM)
(compare:CC
(umin:SI (match_operand:SI 0 "s_register_operand" "r")
(match_operand:SI 1 "s_register_operand" "r"))
(match_operand:SI 2 "s_register_operand" "r")))]
"TARGET_32BIT"
"#"
"&& reload_completed"
[(set (reg:CC CC_REGNUM)
(compare:CC (match_dup 0) (match_dup 2)))
(cond_exec (geu:CC (reg:CC CC_REGNUM) (const_int 0))
(set (reg:CC CC_REGNUM)
(compare:CC (match_dup 1) (match_dup 2))))]
)
(define_expand "umaxsi3"
[(parallel [
(set (match_operand:SI 0 "s_register_operand" "")
......
2015-08-01 Michael Collison <michael.collison@linaro.org
Ramana Radhakrishnan <ramana.radhakrishnan@linaro.org>
* gcc.target/arm/mincmp.c: New test.
2015-08-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67091
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-require-effective-target arm32 } */
#define min(x, y) ((x) <= (y)) ? (x) : (y)
unsigned int
foo (unsigned int i, unsigned int x, unsigned int y)
{
return i < (min (x, y));
}
int
bar (int i, int x, int y)
{
return i < (min (x, y));
}
/* { dg-final { scan-assembler "cmpcs" } } */
/* { dg-final { scan-assembler "cmpge" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment