operands[1] = change_address (operands[1], VOIDmode, addr1);
operands[2] = GEN_INT (INTVAL (operands[2]) - 1);
- emit_insn (gen_movstrsico (operands[0], operands[1], operands[2]));
+ emit_insn (gen_movstrdi_short (operands[0], operands[1], operands[2]));
DONE;
}
else
}
else
{
- rtx label = gen_label_rtx ();
- rtx reg0, reg1, len;
+ rtx label1 = gen_label_rtx ();
+ rtx label2 = gen_label_rtx ();
+ rtx reg0, reg1, len, blocks;
reg0 = gen_reg_rtx (DImode);
reg1 = gen_reg_rtx (DImode);
len = gen_reg_rtx (DImode);
+ blocks = gen_reg_rtx (DImode);
emit_move_insn (len, operands[2]);
emit_insn (gen_cmpdi (len, const0_rtx));
- emit_jump_insn (gen_beq (label));
+ emit_jump_insn (gen_beq (label1));
emit_move_insn (reg0, addr0);
emit_move_insn (reg1, addr1);
emit_insn (gen_adddi3 (len, len, constm1_rtx));
- emit_insn (gen_movstrdix_64 (reg0, reg1, reg0, reg1, len));
- emit_label (label);
+ emit_insn (gen_ashrdi3 (blocks, len, GEN_INT (8)));
+ emit_insn (gen_cmpdi (blocks, const0_rtx));
+ emit_jump_insn (gen_beq (label2));
+ emit_insn (gen_movstrdi_long (reg0, reg1, reg0, reg1, blocks, blocks));
+ emit_label (label2);
+ operands[0] = change_address (operands[0], VOIDmode, reg0);
+ operands[1] = change_address (operands[1], VOIDmode, reg1);
+ emit_insn (gen_movstrdi_short (operands[0], operands[1], len));
+ emit_label (label1);
DONE;
}
}
(match_operand:BLK 1 "general_operand" ""))
(use (match_operand:SI 2 "general_operand" ""))
(match_operand 3 "" "")]
- ""
+ "!TARGET_64BIT"
"
{
rtx addr0 = force_operand (XEXP (operands[0], 0), NULL_RTX);
operands[1] = change_address (operands[1], VOIDmode, addr1);
operands[2] = GEN_INT (INTVAL (operands[2]) - 1);
- emit_insn (gen_movstrsico (operands[0], operands[1], operands[2]));
+ emit_insn (gen_movstrsi_short (operands[0], operands[1], operands[2]));
DONE;
}
else
{
- if (TARGET_64BIT)
- FAIL;
-
if (TARGET_MVCLE)
{
/* implementation suggested by Richard Henderson <rth@cygnus.com> */
}
else
{
- rtx label = gen_label_rtx ();
- rtx reg0, reg1, len;
+ rtx label1 = gen_label_rtx ();
+ rtx label2 = gen_label_rtx ();
+ rtx reg0, reg1, len, blocks;
reg0 = gen_reg_rtx (SImode);
reg1 = gen_reg_rtx (SImode);
len = gen_reg_rtx (SImode);
+ blocks = gen_reg_rtx (SImode);
emit_move_insn (len, operands[2]);
emit_insn (gen_cmpsi (len, const0_rtx));
- emit_jump_insn (gen_beq (label));
+ emit_jump_insn (gen_beq (label1));
emit_move_insn (reg0, addr0);
emit_move_insn (reg1, addr1);
emit_insn (gen_addsi3 (len, len, constm1_rtx));
- emit_insn (gen_movstrsix_31 (reg0, reg1, reg0, reg1, len));
- emit_label (label);
+ emit_insn (gen_ashrsi3 (blocks, len, GEN_INT (8)));
+ emit_insn (gen_cmpsi (blocks, const0_rtx));
+ emit_jump_insn (gen_beq (label2));
+ emit_insn (gen_movstrsi_long (reg0, reg1, reg0, reg1, blocks, blocks));
+ emit_label (label2);
+ operands[0] = change_address (operands[0], VOIDmode, reg0);
+ operands[1] = change_address (operands[1], VOIDmode, reg1);
+ emit_insn (gen_movstrsi_short (operands[0], operands[1], len));
+ emit_label (label1);
DONE;
}
}
}")
-; Move a block that is less than 256 bytes in length.
+; Move a block that is up to 256 bytes in length.
+; The block length is taken as (operands[2] % 256) + 1.
-(define_insn "movstrsico"
- [(set (match_operand:BLK 0 "s_operand" "=oQ")
- (match_operand:BLK 1 "s_operand" "oQ"))
- (use (match_operand 2 "const_int_operand" "I"))]
- "((unsigned) INTVAL (operands[2]) < 256)"
- "mvc\\t%O0(%c2+1,%R0),%1"
- [(set_attr "op_type" "SS")
- (set_attr "atype" "mem")])
+(define_insn "movstrdi_short"
+ [(set (match_operand:BLK 0 "s_operand" "=oQ,oQ")
+ (match_operand:BLK 1 "s_operand" "oQ,oQ"))
+ (use (match_operand:DI 2 "nonmemory_operand" "n,a"))
+ (clobber (match_scratch:DI 3 "=X,&a"))]
+ "TARGET_64BIT"
+ "*
+{
+ switch (which_alternative)
+ {
+ case 0:
+ return \"mvc\\t%O0(%b2+1,%R0),%1\";
+
+ case 1:
+ output_asm_insn (\"bras\\t%3,.+10\", operands);
+ output_asm_insn (\"mvc\\t%O0(1,%R0),%1\", operands);
+ return \"ex\\t%2,0(%3)\";
+
+ default:
+ abort ();
+ }
+}"
+ [(set_attr "op_type" "SS,NN")
+ (set_attr "atype" "mem,mem")
+ (set_attr "length" "*,14")])
+
+(define_insn "movstrsi_short"
+ [(set (match_operand:BLK 0 "s_operand" "=oQ,oQ")
+ (match_operand:BLK 1 "s_operand" "oQ,oQ"))
+ (use (match_operand:SI 2 "nonmemory_operand" "n,a"))
+ (clobber (match_scratch:SI 3 "=X,&a"))]
+ "!TARGET_64BIT"
+ "*
+{
+ switch (which_alternative)
+ {
+ case 0:
+ return \"mvc\\t%O0(%b2+1,%R0),%1\";
+
+ case 1:
+ output_asm_insn (\"bras\\t%3,.+10\", operands);
+ output_asm_insn (\"mvc\\t%O0(1,%R0),%1\", operands);
+ return \"ex\\t%2,0(%3)\";
+
+ default:
+ abort ();
+ }
+}"
+ [(set_attr "op_type" "SS,NN")
+ (set_attr "atype" "mem,mem")
+ (set_attr "length" "*,14")])
-; Move a block that is more than 256 bytes in lenght or length in register
+; Move a block that is a multiple of 256 bytes in length
-(define_insn "movstrdix_64"
- [(use (match_operand:DI 4 "register_operand" "a"))
+(define_insn "movstrdi_long"
+ [(set (match_operand:DI 4 "register_operand" "=d")
+ (const_int 0))
(set (match_operand:DI 0 "register_operand" "=a")
(plus:DI (match_operand:DI 2 "register_operand" "0")
- (and:DI (match_dup 4) (const_int -256))))
+ (ashift:DI (match_operand:DI 5 "register_operand" "4")
+ (const_int 8))))
(set (match_operand:DI 1 "register_operand" "=a")
(plus:DI (match_operand:DI 3 "register_operand" "1")
- (and:DI (match_dup 4) (const_int -256))))
+ (ashift:DI (match_dup 5) (const_int 8))))
(set (mem:BLK (match_dup 2))
(mem:BLK (match_dup 3)))
- (clobber (match_scratch:DI 5 "=&a"))
- (clobber (reg:CC 33))]
- ""
+ (use (match_dup 5))]
+ "TARGET_64BIT"
"*
{
- rtx xop[4];
- xop[0] = gen_label_rtx ();
- xop[1] = gen_label_rtx ();
- xop[2] = gen_label_rtx ();
- xop[3] = operands[5];
- output_asm_insn (\"srag\\t%5,%4,8\", operands);
- output_asm_insn (\"jz\\t%l1\", xop);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[0]));
output_asm_insn (\"mvc\\t0(256,%0),0(%1)\", operands);
output_asm_insn (\"la\\t%0,256(%0)\", operands);
output_asm_insn (\"la\\t%1,256(%1)\", operands);
- output_asm_insn (\"brct\\t%3,%l0\", xop);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[1]));
- output_asm_insn (\"bras\\t%3,%l2\", xop);
- output_asm_insn (\"mvc\\t0(1,%0),0(%1)\", operands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[2]));
- return \"ex\\t%4,0(%5)\";
+ return \"brct\\t%4,.-14\";
}"
[(set_attr "op_type" "NN")
(set_attr "atype" "mem")
- (set_attr "length" "44")])
+ (set_attr "length" "18")])
-(define_insn "movstrsix_31"
- [(use (match_operand:SI 4 "register_operand" "a"))
+(define_insn "movstrsi_long"
+ [(set (match_operand:SI 4 "register_operand" "=d")
+ (const_int 0))
(set (match_operand:SI 0 "register_operand" "=a")
(plus:SI (match_operand:SI 2 "register_operand" "0")
- (and:SI (match_dup 4) (const_int -256))))
+ (ashift:SI (match_operand:SI 5 "register_operand" "4")
+ (const_int 8))))
(set (match_operand:SI 1 "register_operand" "=a")
(plus:SI (match_operand:SI 3 "register_operand" "1")
- (and:SI (match_dup 4) (const_int -256))))
+ (ashift:SI (match_dup 5) (const_int 8))))
(set (mem:BLK (match_dup 2))
(mem:BLK (match_dup 3)))
- (clobber (match_scratch:SI 5 "=&a"))
- (clobber (reg:CC 33))]
- ""
+ (use (match_dup 5))]
+ "!TARGET_64BIT"
"*
{
- rtx xop[4];
- xop[0] = gen_label_rtx ();
- xop[1] = gen_label_rtx ();
- xop[2] = gen_label_rtx ();
- xop[3] = operands[5];
- output_asm_insn (\"lr\\t%5,%4\", operands);
- output_asm_insn (\"sra\\t%5,8\", operands);
- output_asm_insn (\"jz\\t%l1\", xop);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[0]));
output_asm_insn (\"mvc\\t0(256,%0),0(%1)\", operands);
output_asm_insn (\"la\\t%0,256(%0)\", operands);
output_asm_insn (\"la\\t%1,256(%1)\", operands);
- output_asm_insn (\"brct\\t%3,%l0\", xop);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[1]));
- output_asm_insn (\"bras\\t%3,%l2\", xop);
- output_asm_insn (\"mvc\\t0(1,%0),0(%1)\", operands);
- ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
- CODE_LABEL_NUMBER (xop[2]));
- return \"ex\\t%4,0(%5)\";
+ return \"brct\\t%4,.-14\";
}"
- [(set_attr "op_type" "NN")
- (set_attr "length" "42")
- (set_attr "atype" "mem")])
+ [(set_attr "op_type" "NN")
+ (set_attr "atype" "mem")
+ (set_attr "length" "18")])
; Move a block that is larger than 255 bytes in length.
operands[4] = gen_reg_rtx(TImode);
emit_insn (gen_rtx_CLOBBER (VOIDmode, operands[4]));
emit_move_insn (gen_lowpart (DImode, operands[4]), operands[1]);
+ emit_move_insn (gen_highpart (DImode, operands[4]), const0_rtx);
insn = emit_insn (gen_divmodtidi3 (operands[4], operands[4], operands[2]));
REG_NOTES (insn) =
gen_rtx_EXPR_LIST (REG_EQUAL, equal, REG_NOTES (insn));
(define_insn "rotldi3"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(rotate:DI (match_operand:DI 1 "register_operand" "d,d")
- (match_operand:DI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"TARGET_64BIT"
"@
rllg\\t%0,%1,%c2
(define_insn "rotlsi3"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(rotate:SI (match_operand:SI 1 "register_operand" "d,d")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"TARGET_64BIT"
"@
rll\\t%0,%1,%c2
;;
;;- Arithmetic shift instructions.
;;
-;; for left shifts always setal shifts are used (ANSI-C)
;
; ashldi3 instruction pattern(s).
;
(define_expand "ashldi3"
- [(parallel
- [(set (match_operand:DI 0 "register_operand" "")
- (ashift:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))
- (clobber (reg:CC 33))])]
+ [(set (match_operand:DI 0 "register_operand" "")
+ (ashift:DI (match_operand:DI 1 "register_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))]
""
"")
(define_insn "*ashldi3_31"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(ashift:DI (match_operand:DI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"!TARGET_64BIT"
"@
sldl\\t%0,%c2
[(set_attr "op_type" "RS")])
(define_insn "*ashldi3_64"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
+ [(set (match_operand:DI 0 "register_operand" "=d,d")
(ashift:DI (match_operand:DI 1 "register_operand" "d,d")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"TARGET_64BIT"
"@
sllg\\t%0,%1,%2
""
"")
+(define_insn "*ashrdi3_cc_31"
+ [(set (reg 33)
+ (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (set (match_operand:DI 0 "register_operand" "=d,d")
+ (ashiftrt:DI (match_dup 1) (match_dup 2)))]
+ "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
+ "@
+ srda\\t%0,%c2
+ srda\\t%0,0(%2)"
+ [(set_attr "op_type" "RS")])
+
+(define_insn "*ashrdi3_cconly_31"
+ [(set (reg 33)
+ (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (clobber (match_scratch:DI 0 "=d,d"))]
+ "!TARGET_64BIT && s390_match_ccmode(insn, CCSmode)"
+ "@
+ srda\\t%0,%c2
+ srda\\t%0,0(%2)"
+ [(set_attr "op_type" "RS")])
+
(define_insn "*ashrdi3_31"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
srda\\t%0,0(%2)"
[(set_attr "op_type" "RS")])
+(define_insn "*ashrdi3_cc_64"
+ [(set (reg 33)
+ (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (set (match_operand:DI 0 "register_operand" "=d,d")
+ (ashiftrt:DI (match_dup 1) (match_dup 2)))]
+ "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
+ "@
+ srag\\t%0,%1,%c2
+ srag\\t%0,%1,0(%2)"
+ [(set_attr "op_type" "RSE")])
+
+(define_insn "*ashrdi3_cconly_64"
+ [(set (reg 33)
+ (compare (ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (clobber (match_scratch:DI 0 "=d,d"))]
+ "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT"
+ "@
+ srag\\t%0,%1,%c2
+ srag\\t%0,%1,0(%2)"
+ [(set_attr "op_type" "RSE")])
+
(define_insn "*ashrdi3_64"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(ashiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
;
; ashlsi3 instruction pattern(s).
;
-; all 32 bits has to be shifted (testcase co750c)
(define_insn "ashlsi3"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(ashift:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
""
"@
sll\\t%0,%c2
; ashrsi3 instruction pattern(s).
;
+(define_insn "*ashrsi3_cc"
+ [(set (reg 33)
+ (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (set (match_operand:SI 0 "register_operand" "=d,d")
+ (ashiftrt:SI (match_dup 1) (match_dup 2)))]
+ "s390_match_ccmode(insn, CCSmode)"
+ "@
+ sra\\t%0,%c2
+ sra\\t%0,0(%2)"
+ [(set_attr "op_type" "RS")])
+
+(define_insn "*ashrsi3_cconly"
+ [(set (reg 33)
+ (compare (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:SI 2 "nonmemory_operand" "J,a"))
+ (const_int 0)))
+ (clobber (match_scratch:SI 0 "=d,d"))]
+ "s390_match_ccmode(insn, CCSmode)"
+ "@
+ sra\\t%0,%c2
+ sra\\t%0,0(%2)"
+ [(set_attr "op_type" "RS")])
+
(define_insn "ashrsi3"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
;
(define_expand "lshrdi3"
- [(parallel
- [(set (match_operand:DI 0 "register_operand" "")
- (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
- (match_operand:SI 2 "nonmemory_operand" "")))
- (clobber (reg:CC 33))])]
+ [(set (match_operand:DI 0 "register_operand" "")
+ (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))]
""
"")
(define_insn "*lshrdi3_31"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(lshiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"!TARGET_64BIT"
"@
srdl\\t%0,%c2
(define_insn "*lshrdi3_64"
[(set (match_operand:DI 0 "register_operand" "=d,d")
(lshiftrt:DI (match_operand:DI 1 "register_operand" "d,d")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
"TARGET_64BIT"
"@
srlg\\t%0,%1,%c2
(define_insn "lshrsi3"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
- (match_operand:SI 2 "nonmemory_operand" "J,a")))
- (clobber (reg:CC 33))]
+ (match_operand:SI 2 "nonmemory_operand" "J,a")))]
""
"@
srl\\t%0,%c2