[09/11,s390] Fix ambiguous .md attribute uses

Message ID mptimsgwlo8.fsf@arm.com
State New
Headers show
Series
  • Diagnose ambiguous .md attribute uses
Related show

Commit Message

Richard Sandiford July 5, 2019, 3:22 p.m.
This patch is part of a series that fixes ambiguous attribute
uses in .md files, i.e. cases in which attributes didn't use
<ITER:ATTR> to specify an iterator, and in which <ATTR> could
have different values depending on the iterator chosen.

The vx-builtins.md part changes the choice of <mode> from the
implicit <VFCMP:mode> to an explicit <VF_HW:mode> (i.e. from the
mode of the comparison result to the mode of the operands being
compared).  That seemed like the intended behaviour given later
patterns like vec_cmpeq<mode>_cc.

The use of BFP in the s390.md LNDFR pattern looks like a typo,
since the operand to (abs ...) has to have the same mode as the result.
The only effect before this series was to create some extra variants
that would never match, making it harmless apart from very minor code
bloat.


2019-07-05  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/s390/s390.md (*negabs<FP:mode>2_nocc): Use FP for
	operand 1.
	* config/s390/vx-builtins.md (*vec_cmp<insn_cmp><mode>_cconly):
	Make the choice of <mode> explicit, giving...
	(*vec_cmp<insn_cmp><VF_HW:mode>_cconly): ...this.

Comments

Andreas Krebbel July 5, 2019, 3:52 p.m. | #1
On 05.07.19 17:22, Richard Sandiford wrote:
> This patch is part of a series that fixes ambiguous attribute

> uses in .md files, i.e. cases in which attributes didn't use

> <ITER:ATTR> to specify an iterator, and in which <ATTR> could

> have different values depending on the iterator chosen.

> 

> The vx-builtins.md part changes the choice of <mode> from the

> implicit <VFCMP:mode> to an explicit <VF_HW:mode> (i.e. from the

> mode of the comparison result to the mode of the operands being

> compared).  That seemed like the intended behaviour given later

> patterns like vec_cmpeq<mode>_cc.

> 

> The use of BFP in the s390.md LNDFR pattern looks like a typo,

> since the operand to (abs ...) has to have the same mode as the result.

> The only effect before this series was to create some extra variants

> that would never match, making it harmless apart from very minor code

> bloat.

> 

> 

> 2019-07-05  Richard Sandiford  <richard.sandiford@arm.com>

> 

> gcc/

> 	* config/s390/s390.md (*negabs<FP:mode>2_nocc): Use FP for

> 	operand 1.

> 	* config/s390/vx-builtins.md (*vec_cmp<insn_cmp><mode>_cconly):

> 	Make the choice of <mode> explicit, giving...

> 	(*vec_cmp<insn_cmp><VF_HW:mode>_cconly): ...this.


Ok. Thanks for fix!

Andreas

Patch

Index: gcc/config/s390/s390.md
===================================================================
--- gcc/config/s390/s390.md	2019-07-01 09:37:06.016534568 +0100
+++ gcc/config/s390/s390.md	2019-07-05 15:08:27.018977508 +0100
@@ -8821,8 +8821,8 @@  (define_insn "*negabs<mode>2_cconly"
 
 ; lndfr
 (define_insn "*negabs<mode>2_nocc"
-  [(set (match_operand:FP 0 "register_operand"                  "=f")
-        (neg:FP (abs:FP (match_operand:BFP 1 "register_operand" "<fT0>"))))]
+  [(set (match_operand:FP 0 "register_operand"                 "=f")
+        (neg:FP (abs:FP (match_operand:FP 1 "register_operand" "<fT0>"))))]
   "TARGET_DFP"
   "lndfr\t%0,%1"
   [(set_attr "op_type"  "RRE")
Index: gcc/config/s390/vx-builtins.md
===================================================================
--- gcc/config/s390/vx-builtins.md	2019-04-18 13:28:51.035821466 +0100
+++ gcc/config/s390/vx-builtins.md	2019-07-05 15:08:27.018977508 +0100
@@ -2046,7 +2046,7 @@  (define_insn "*vec_cmphl<VI_HW:mode>_cc"
 ;;
 
 ; vfcesbs, vfcedbs, wfcexbs, vfchsbs, vfchdbs, wfchxbs, vfchesbs, vfchedbs, wfchexbs
-(define_insn "*vec_cmp<insn_cmp><mode>_cconly"
+(define_insn "*vec_cmp<insn_cmp><VF_HW:mode>_cconly"
   [(set (reg:VFCMP CC_REGNUM)
 	(compare:VFCMP (match_operand:VF_HW 0 "register_operand" "v")
 		       (match_operand:VF_HW 1 "register_operand" "v")))