+2012-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+
+ * config/s390/s390-protos.h (s390_expand_movmem)
+ (s390_expand_cmpmem): Add return value.
+ * config/s390/s390.c (s390_expand_movmem, s390_expand_cmpmem):
+ Return FALSE to use the library function in some cases.
+ * config/s390/s390.md (movmem, cmpmem): Evaluate return value of C
+ helper functions.
+
2012-07-05 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config.gcc: Enable ifunc attribute by default on s390 and s390x.
extern void s390_expand_plus_operand (rtx, rtx, rtx);
extern void emit_symbolic_move (rtx *);
extern void s390_load_address (rtx, rtx);
-extern void s390_expand_movmem (rtx, rtx, rtx);
+extern bool s390_expand_movmem (rtx, rtx, rtx);
extern void s390_expand_setmem (rtx, rtx, rtx);
-extern void s390_expand_cmpmem (rtx, rtx, rtx, rtx);
+extern bool s390_expand_cmpmem (rtx, rtx, rtx, rtx);
extern bool s390_expand_addcc (enum rtx_code, rtx, rtx, rtx, rtx, rtx);
extern bool s390_expand_insv (rtx, rtx, rtx, rtx);
extern void s390_expand_cs_hqi (enum machine_mode, rtx, rtx, rtx, rtx);
/* Emit code to move LEN bytes from DST to SRC. */
-void
+bool
s390_expand_movmem (rtx dst, rtx src, rtx len)
{
+ /* When tuning for z10 or higher we rely on the Glibc functions to
+ do the right thing. Only for constant lengths below 64k we will
+ generate inline code. */
+ if (s390_tune >= PROCESSOR_2097_Z10
+ && (GET_CODE (len) != CONST_INT || INTVAL (len) > (1<<16)))
+ return false;
+
if (GET_CODE (len) == CONST_INT && INTVAL (len) >= 0 && INTVAL (len) <= 256)
{
if (INTVAL (len) > 0)
convert_to_mode (Pmode, count, 1)));
emit_label (end_label);
}
+ return true;
}
/* Emit code to set LEN bytes at DST to VAL.
/* Emit code to compare LEN bytes at OP0 with those at OP1,
and return the result in TARGET. */
-void
+bool
s390_expand_cmpmem (rtx target, rtx op0, rtx op1, rtx len)
{
rtx ccreg = gen_rtx_REG (CCUmode, CC_REGNUM);
rtx tmp;
+ /* When tuning for z10 or higher we rely on the Glibc functions to
+ do the right thing. Only for constant lengths below 64k we will
+ generate inline code. */
+ if (s390_tune >= PROCESSOR_2097_Z10
+ && (GET_CODE (len) != CONST_INT || INTVAL (len) > (1<<16)))
+ return false;
+
/* As the result of CMPINT is inverted compared to what we need,
we have to swap the operands. */
tmp = op0; op0 = op1; op1 = tmp;
emit_insn (gen_cmpint (target, ccreg));
}
+ return true;
}
(use (match_operand:GPR 2 "general_operand" "")) ; count
(match_operand 3 "" "")]
""
- "s390_expand_movmem (operands[0], operands[1], operands[2]); DONE;")
+{
+ if (s390_expand_movmem (operands[0], operands[1], operands[2]))
+ DONE;
+ else
+ FAIL;
+})
; Move a block that is up to 256 bytes in length.
; The block length is taken as (operands[2] % 256) + 1.
(use (match_operand:SI 3 "general_operand" ""))
(use (match_operand:SI 4 "" ""))]
""
- "s390_expand_cmpmem (operands[0], operands[1],
- operands[2], operands[3]); DONE;")
+{
+ if (s390_expand_cmpmem (operands[0], operands[1],
+ operands[2], operands[3]))
+ DONE;
+ else
+ FAIL;
+})
; Compare a block that is up to 256 bytes in length.
; The block length is taken as (operands[2] % 256) + 1.