[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-22 Thread xuemaosheng at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

--- Comment #7 from otcmaf  ---
(In reply to Andrew Pinski from comment #5)
> (In reply to otcmaf from comment #4)
> > Do you mean that those pattern above are also wrong pattern ?
> 
> YES those are broken.

Ok, thanks very much.

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-22 Thread zhongyunde at tom dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

zhongyunde at tom dot com  changed:

   What|Removed |Added

 CC||zhongyunde at tom dot com

--- Comment #6 from zhongyunde at tom dot com  ---
*** Bug 95210 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

--- Comment #5 from Andrew Pinski  ---
(In reply to otcmaf from comment #4)
> Do you mean that those pattern above are also wrong pattern ?

YES those are broken.

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-21 Thread xuemaosheng at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

--- Comment #4 from otcmaf  ---
(In reply to Andrew Pinski from comment #3)
> The internals documentation documents this even, read:
> https://gcc.gnu.org/onlinedocs/gccint/RTL-Template.html#index-match_005fdup
> 
> From that:
> Note that match_dup should not be used to tell the compiler that a
> particular register is being used for two operands (example: add that adds
> one register to another; the second register is both an input operand and
> the output operand). Use a matching constraint (see Simple Constraints) for
> those.

However, in gcc/config/aarch64/aarch64-simd.md also has the similar usage。
For example:
1227 (define_insn "aarch64_simd_move_hi_quad_"
1228   [(set (match_operand:VQ 0 "register_operand" "+w,w") 
1229 (vec_concat:VQ 
1230   (vec_select:  
1231 (match_dup 0)  
1232 (match_operand:VQ 2 "vect_par_cnst_lo_half" ""))   
1233   (match_operand: 1 "register_operand" "w,r")))]
1234   "TARGET_SIMD && !BYTES_BIG_ENDIAN"   
1235   "@   
1236ins\\t%0.d[1], %1.d[0]  
1237ins\\t%0.d[1], %1"  
1238   [(set_attr "type" "neon_ins")]   
1239 ) 
the operands[0] is a inout reg, and the pattern also use (match_dup 0).

Another case in gcc/config/c6x/c6x.md
 440 (define_insn "*movstricthi_high"   
 441   [(set (match_operand:SI 0 "register_operand" "+ab")  
 442 (ior:SI (and:SI (match_dup 0) (const_int 65535))   
 443 (ashift:SI (match_operand:SI 1 "const_int_operand" "IuB")  
 444(const_int 16]  
 445   "reload_completed"   
 446   "%|%.\\tmvklh\\t%$\\t%1, %0" 
 447   [(set_attr "units" "s")]) 

2930 (define_insn "setup_dsbt"  
2931   [(set (match_operand:SI 0 "pic_register_operand" "+Z")   
2932 (unspec:SI [(match_dup 0)  
2933 (match_operand:SI 1 "symbolic_operand" "")]
2934UNSPEC_SETUP_DSBT))]
2935   "TARGET_DSBT"
2936   "%|%.\\tldw\\t%$\\t*+%0($DSBT_index%1), %0"  
2937   [(set_attr "type" "load")
2938(set_attr "units" "d_addr") 
2939(set_attr "dest_regfile" "b")   
2940(set_attr "addr_regfile" "b")]) 


Do you mean that those pattern above are also wrong pattern ?
As you say that, that match_dup should not be used to tell the compiler that a
particular register is being used for two operands.
But I still think that the function can_assign_to_reg_without_clobbers_p can do
bettter, use max_reg_num to replace FIRST_PSEUDO_REGISTER * 2 and update
TEST_INSN when calling this function.

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Andrew Pinski  ---
The internals documentation documents this even, read:
https://gcc.gnu.org/onlinedocs/gccint/RTL-Template.html#index-match_005fdup

>From that:
Note that match_dup should not be used to tell the compiler that a particular
register is being used for two operands (example: add that adds one register to
another; the second register is both an input operand and the output operand).
Use a matching constraint (see Simple Constraints) for those.

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-21 Thread xuemaosheng at huawei dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

--- Comment #2 from otcmaf  ---
(In reply to Andrew Pinski from comment #1)
> I think this is a back-end issue.
> Can you provide the definition of movtv8hf16 ?
> I don't think you can do:
> (set (match_operand 0 predicate constraint)
> (unspec:V8HF16 [
> (match_operand 1 predicate constraint)
> (match_operand 2 predicate constraint)
> (match_dup 0)
> ] UNSPEC_MOVTVFM)))
> 
> Rather you need to do:
> (set (match_operand 0 predicate constraint)
> (unspec:V8HF16 [
> (match_operand 1 predicate constraint)
> (match_operand 2 predicate constraint)
> (match_operand 3 predicate "0")
> ] UNSPEC_MOVTVFM)))

we use this definition of movtv8hf16:
(define_insn "movtv8hf16"   
  [(set (match_operand:V8HF16 0 "register_operand_s" "+Zrv")
(unspec:V8HF16 [(match_operand:V8HF16 1 "register_operand_s" "Zrv") 
(match_operand:BF8 2 "register_operand_s" "Zrb")
(match_dup 0)]UNSPEC_MOVTVFM))]

why we can't use (match_dup 0) ?

[Bug rtl-optimization/95267] [ICE][gcse]: in process_insert_insn at gcse.c

2020-05-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95267

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2020-05-22

--- Comment #1 from Andrew Pinski  ---
I think this is a back-end issue.
Can you provide the definition of movtv8hf16 ?
I don't think you can do:
(set (match_operand 0 predicate constraint)
(unspec:V8HF16 [
(match_operand 1 predicate constraint)
(match_operand 2 predicate constraint)
(match_dup 0)
] UNSPEC_MOVTVFM)))

Rather you need to do:
(set (match_operand 0 predicate constraint)
(unspec:V8HF16 [
(match_operand 1 predicate constraint)
(match_operand 2 predicate constraint)
(match_operand 3 predicate "0")
] UNSPEC_MOVTVFM)))