Commit 163f23d2 by Andreas Krebbel Committed by Andreas Krebbel

IBM Z: Add pattern for load truth value of comparison into reg

The RTXs used to express an overflow condition check in add/sub/mul are
too complex for if conversion.  However, there is code in
noce_emit_store_flag which generates a simple CC compare as the base
for using a conditional load.  All we have to do is to provide a
pattern to store the truth value of a CC compare into a GPR.

Done with the attached patch.

2019-11-07  Andreas Krebbel  <krebbel@linux.ibm.com>

	* config/s390/s390.md ("*cstorecc<mode>_z13"): New insn_and_split
	pattern.

gcc/testsuite/ChangeLog:

2019-11-07  Andreas Krebbel  <krebbel@linux.ibm.com>

	* gcc.target/s390/addsub-signed-overflow-1.c: Expect lochi
	instructions to be used.
	* gcc.target/s390/addsub-signed-overflow-2.c: Likewise.
	* gcc.target/s390/mul-signed-overflow-1.c: Likewise.
	* gcc.target/s390/mul-signed-overflow-2.c: Likewise.
	* gcc.target/s390/vector/vec-scalar-cmp-1.c: Check for 32 and 64
	bit variant of lochi.  Swap the values for the lochi's.
	* gcc.target/s390/zvector/vec-cmp-1.c: Likewise.

From-SVN: r277922
parent 084d3902
2019-11-07 Andreas Krebbel <krebbel@linux.ibm.com>
* config/s390/s390.md ("*cstorecc<mode>_z13"): New insn_and_split
pattern.
2019-11-07 Richard Biener <rguenther@suse.de> 2019-11-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/92405 PR tree-optimization/92405
...@@ -6810,6 +6810,21 @@ ...@@ -6810,6 +6810,21 @@
[(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28))) [(set (match_dup 0) (ashiftrt:SI (match_dup 0) (const_int 28)))
(clobber (reg:CC CC_REGNUM))])]) (clobber (reg:CC CC_REGNUM))])])
; Such patterns get directly emitted by noce_emit_store_flag.
(define_insn_and_split "*cstorecc<mode>_z13"
[(set (match_operand:GPR 0 "register_operand" "=&d")
(match_operator:GPR 1 "s390_comparison"
[(match_operand 2 "cc_reg_operand" "c")
(match_operand 3 "const_int_operand" "")]))]
"TARGET_Z13"
"#"
"reload_completed"
[(set (match_dup 0) (const_int 0))
(set (match_dup 0)
(if_then_else:GPR
(match_op_dup 1 [(match_dup 2) (match_dup 3)])
(const_int 1)
(match_dup 0)))])
;; ;;
;; - Conditional move instructions (introduced with z196) ;; - Conditional move instructions (introduced with z196)
......
2019-11-07 Andreas Krebbel <krebbel@linux.ibm.com>
* gcc.target/s390/addsub-signed-overflow-1.c: Expect lochi
instructions to be used.
* gcc.target/s390/addsub-signed-overflow-2.c: Likewise.
* gcc.target/s390/mul-signed-overflow-1.c: Likewise.
* gcc.target/s390/mul-signed-overflow-2.c: Likewise.
* gcc.target/s390/vector/vec-scalar-cmp-1.c: Check for 32 and 64
bit variant of lochi. Swap the values for the lochi's.
* gcc.target/s390/zvector/vec-cmp-1.c: Likewise.
2019-11-07 Martin Jambor <mjambor@suse.cz> 2019-11-07 Martin Jambor <mjambor@suse.cz>
PR lto/70929 PR lto/70929
......
...@@ -79,3 +79,5 @@ main () ...@@ -79,3 +79,5 @@ main ()
/* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */ /* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */
/* Just one for the ret != 6 comparison. */ /* Just one for the ret != 6 comparison. */
/* { dg-final { scan-assembler-times "ci" 1 } } */ /* { dg-final { scan-assembler-times "ci" 1 } } */
/* { dg-final { scan-assembler-times "\tlochio\t" 6 { target { ! lp64 } } } } */
/* { dg-final { scan-assembler-times "\tlocghio\t" 6 { target lp64 } } } */
...@@ -78,3 +78,5 @@ main () ...@@ -78,3 +78,5 @@ main ()
/* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */ /* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */
/* Just one for the ret != 3 comparison. */ /* Just one for the ret != 3 comparison. */
/* { dg-final { scan-assembler-times "ci" 1 } } */ /* { dg-final { scan-assembler-times "ci" 1 } } */
/* { dg-final { scan-assembler-times "\tlochio\t" 6 { target { ! lp64 } } } } */
/* { dg-final { scan-assembler-times "\tlocghio\t" 6 { target lp64 } } } */
...@@ -54,3 +54,5 @@ main () ...@@ -54,3 +54,5 @@ main ()
/* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */ /* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */
/* Just one for the ret != 3 comparison. */ /* Just one for the ret != 3 comparison. */
/* { dg-final { scan-assembler-times "ci" 1 } } */ /* { dg-final { scan-assembler-times "ci" 1 } } */
/* { dg-final { scan-assembler-times "\tlochio\t" 3 { target { ! lp64 } } } } */
/* { dg-final { scan-assembler-times "\tlocghio\t" 3 { target lp64 } } } */
...@@ -54,3 +54,5 @@ main () ...@@ -54,3 +54,5 @@ main ()
/* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */ /* { dg-final { scan-assembler-not "\trisbg" { target { lp64 } } } } */
/* Just one for the ret != 3 comparison. */ /* Just one for the ret != 3 comparison. */
/* { dg-final { scan-assembler-times "ci" 1 } } */ /* { dg-final { scan-assembler-times "ci" 1 } } */
/* { dg-final { scan-assembler-times "\tlochio\t" 3 { target { ! lp64 } } } } */
/* { dg-final { scan-assembler-times "\tlocghio\t" 3 { target lp64 } } } */
...@@ -12,7 +12,8 @@ eq (double a, double b) ...@@ -12,7 +12,8 @@ eq (double a, double b)
return a == b; return a == b;
} }
/* { dg-final { scan-assembler "eq:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochine\t%r2,0" } } */ /* { dg-final { scan-assembler "eq:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochie\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "eq:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghie\t%r2,1" { target lp64 } } } */
int int
ne (double a, double b) ne (double a, double b)
...@@ -23,7 +24,8 @@ ne (double a, double b) ...@@ -23,7 +24,8 @@ ne (double a, double b)
return a != b; return a != b;
} }
/* { dg-final { scan-assembler "ne:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochie\t%r2,0" } } */ /* { dg-final { scan-assembler "ne:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochine\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "ne:\n\[^:\]*\twfcdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghine\t%r2,1" { target lp64 } } } */
int int
gt (double a, double b) gt (double a, double b)
...@@ -34,7 +36,8 @@ gt (double a, double b) ...@@ -34,7 +36,8 @@ gt (double a, double b)
return a > b; return a > b;
} }
/* { dg-final { scan-assembler "gt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochinh\t%r2,0" } } */ /* { dg-final { scan-assembler "gt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochih\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "gt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghih\t%r2,1" { target lp64 } } } */
int int
ge (double a, double b) ge (double a, double b)
...@@ -45,7 +48,8 @@ ge (double a, double b) ...@@ -45,7 +48,8 @@ ge (double a, double b)
return a >= b; return a >= b;
} }
/* { dg-final { scan-assembler "ge:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochinhe\t%r2,0" } } */ /* { dg-final { scan-assembler "ge:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochihe\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "ge:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghihe\t%r2,1" { target lp64 } } } */
int int
lt (double a, double b) lt (double a, double b)
...@@ -56,7 +60,8 @@ lt (double a, double b) ...@@ -56,7 +60,8 @@ lt (double a, double b)
return a < b; return a < b;
} }
/* { dg-final { scan-assembler "lt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochinl\t%r2,0" } } */ /* { dg-final { scan-assembler "lt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochil\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "lt:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghil\t%r2,1" { target lp64 } } } */
int int
le (double a, double b) le (double a, double b)
...@@ -67,4 +72,5 @@ le (double a, double b) ...@@ -67,4 +72,5 @@ le (double a, double b)
return a <= b; return a <= b;
} }
/* { dg-final { scan-assembler "le:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochinle\t%r2,0" } } */ /* { dg-final { scan-assembler "le:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlochile\t%r2,1" { target { ! lp64 } } } } */
/* { dg-final { scan-assembler "le:\n\[^:\]*\twfkdb\t%v\[0-9\]*,%v\[0-9\]*\n\t\[^:\]+\tlocghile\t%r2,1" { target lp64 } } } */
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