Skip to content

Commit

Permalink
Revert "RISC-V: Support highpart register overlap for vwcvt"
Browse files Browse the repository at this point in the history
This reverts commit bdad036.
  • Loading branch information
Incarnation-p-lee committed Apr 24, 2024
1 parent 152d945 commit bc17a92
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 294 deletions.
23 changes: 0 additions & 23 deletions gcc/config/riscv/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,29 +159,6 @@
(define_register_constraint "vm" "TARGET_VECTOR ? VM_REGS : NO_REGS"
"A vector mask register (if available).")

;; These following constraints are used by RVV instructions with dest EEW > src EEW.
;; RISC-V 'V' Spec 5.2. Vector Operands:
;; The destination EEW is greater than the source EEW, the source EMUL is at least 1,
;; and the overlap is in the highest-numbered part of the destination register group.
;; (e.g., when LMUL=8, vzext.vf4 v0, v6 is legal, but a source of v0, v2, or v4 is not).
(define_register_constraint "W21" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 2 == 1." "regno % 2 == 1")

(define_register_constraint "W42" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 4 == 2." "regno % 4 == 2")

(define_register_constraint "W84" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 8 == 4." "regno % 8 == 4")

(define_register_constraint "W41" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 4 == 1." "regno % 4 == 1")

(define_register_constraint "W81" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 8 == 1." "regno % 8 == 1")

(define_register_constraint "W82" "TARGET_VECTOR ? V_REGS : NO_REGS"
"A vector register has register number % 8 == 2." "regno % 8 == 2")

;; This constraint is used to match instruction "csrr %0, vlenb" which is generated in "mov<mode>".
;; VLENB is a run-time constant which represent the vector register length in bytes.
;; BYTES_PER_RISCV_VECTOR represent runtime invariant of vector register length in bytes.
Expand Down
24 changes: 0 additions & 24 deletions gcc/config/riscv/riscv.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,27 +538,6 @@
]
(const_string "no")))

(define_attr "vconstraint" "no,W21,W42,W84,W41,W81,W82"
(const_string "no"))

(define_attr "vconstraint_enabled" "no,yes"
(cond [(eq_attr "vconstraint" "no")
(const_string "yes")

(and (eq_attr "vconstraint" "W21")
(match_test "riscv_get_v_regno_alignment (GET_MODE (operands[0])) != 2"))
(const_string "no")

(and (eq_attr "vconstraint" "W42,W41")
(match_test "riscv_get_v_regno_alignment (GET_MODE (operands[0])) != 4"))
(const_string "no")

(and (eq_attr "vconstraint" "W84,W81,W82")
(match_test "riscv_get_v_regno_alignment (GET_MODE (operands[0])) != 8"))
(const_string "no")
]
(const_string "yes")))

;; This attribute marks the alternatives not matching the constraints
;; described in spec as disabled.
(define_attr "spec_restriction" "none,thv,rvv"
Expand Down Expand Up @@ -587,9 +566,6 @@
(eq_attr "fp_vector_disabled" "yes")
(const_string "no")

(eq_attr "vconstraint_enabled" "no")
(const_string "no")

(eq_attr "spec_restriction_disabled" "yes")
(const_string "no")
]
Expand Down
21 changes: 10 additions & 11 deletions gcc/config/riscv/vector-crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,25 @@
(set_attr "mode" "<V_DOUBLE_TRUNC>")])

(define_insn "@pred_vwsll<mode>_scalar"
[(set (match_operand:VWEXTI 0 "register_operand" "=vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, vd, vr, ?&vr, ?&vr")
[(set (match_operand:VWEXTI 0 "register_operand" "=vr, vr")
(if_then_else:VWEXTI
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" " vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1, vm,Wc1,vmWc1,vmWc1")
(match_operand 5 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK")
(match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i")
(match_operand 8 "const_int_operand" " i, i, i, i, i, i, i, i, i, i, i, i, i, i")
[(match_operand:<VM> 1 "vector_mask_operand" "vmWc1, vmWc1")
(match_operand 5 "vector_length_operand" " rK, rK")
(match_operand 6 "const_int_operand" " i, i")
(match_operand 7 "const_int_operand" " i, i")
(match_operand 8 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(ashift:VWEXTI
(zero_extend:VWEXTI
(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84, vr, vr"))
(match_operand:<VSUBEL> 4 "pmode_reg_or_uimm5_operand" " rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK, rK"))
(match_operand:VWEXTI 2 "vector_merge_operand" " vu, vu, 0, 0, vu, vu, 0, 0, vu, vu, 0, 0, vu, 0")))]
(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr, vr"))
(match_operand:<VSUBEL> 4 "pmode_reg_or_uimm5_operand" " rK, rK"))
(match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
"TARGET_ZVBB"
"vwsll.v%o4\t%0,%3,%4%p1"
[(set_attr "type" "vwsll")
(set_attr "mode" "<V_DOUBLE_TRUNC>")
(set_attr "vconstraint" "W21,W21,W21,W21,W42,W42,W42,W42,W84,W84,W84,W84,no,no")])
(set_attr "mode" "<V_DOUBLE_TRUNC>")])

;; vbrev.v vbrev8.v vrev8.v
(define_insn "@pred_v<rev><mode>"
Expand Down
19 changes: 9 additions & 10 deletions gcc/config/riscv/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -3945,31 +3945,30 @@

;; vwcvt<u>.x.x.v
(define_insn "@pred_<optab><mode>"
[(set (match_operand:VWEXTI 0 "register_operand" "=vr, vr, vr, vr, vr, vr, ?&vr, ?&vr")
[(set (match_operand:VWEXTI 0 "register_operand" "=&vr,&vr")
(if_then_else:VWEXTI
(unspec:<VM>
[(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1,vmWc1")
(match_operand 4 "vector_length_operand" " rK, rK, rK, rK, rK, rK, rK, rK")
(match_operand 5 "const_int_operand" " i, i, i, i, i, i, i, i")
(match_operand 6 "const_int_operand" " i, i, i, i, i, i, i, i")
(match_operand 7 "const_int_operand" " i, i, i, i, i, i, i, i")
[(match_operand:<VM> 1 "vector_mask_operand" "vmWc1,vmWc1")
(match_operand 4 "vector_length_operand" " rK, rK")
(match_operand 5 "const_int_operand" " i, i")
(match_operand 6 "const_int_operand" " i, i")
(match_operand 7 "const_int_operand" " i, i")
(reg:SI VL_REGNUM)
(reg:SI VTYPE_REGNUM)] UNSPEC_VPREDICATE)
(plus:VWEXTI
(any_extend:VWEXTI
(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " W21, W21, W42, W42, W84, W84, vr, vr"))
(match_operand:<V_DOUBLE_TRUNC> 3 "register_operand" " vr, vr"))
(vec_duplicate:VWEXTI
(reg:<VEL> X0_REGNUM)))
(match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0, vu, 0, vu, 0, vu, 0")))]
(match_operand:VWEXTI 2 "vector_merge_operand" " vu, 0")))]
"TARGET_VECTOR"
"vwcvt<u>.x.x.v\t%0,%3%p1"
[(set_attr "type" "viwalu")
(set_attr "mode" "<V_DOUBLE_TRUNC>")
(set_attr "vl_op_idx" "4")
(set (attr "ta") (symbol_ref "riscv_vector::get_ta(operands[5])"))
(set (attr "ma") (symbol_ref "riscv_vector::get_ma(operands[6])"))
(set (attr "avl_type_idx") (const_int 7))
(set_attr "vconstraint" "W21,W21,W42,W42,W84,W84,no,no")])
(set (attr "avl_type_idx") (const_int 7))])

;; -------------------------------------------------------------------------------
;; ---- Predicated integer Narrowing operations
Expand Down
104 changes: 0 additions & 104 deletions gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-1.c

This file was deleted.

68 changes: 0 additions & 68 deletions gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-2.c

This file was deleted.

51 changes: 0 additions & 51 deletions gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-3.c

This file was deleted.

2 changes: 1 addition & 1 deletion gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-39.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ foo2 (void *in, void *out, int n)
/* { dg-final { scan-assembler-not {vmv2r} { xfail riscv*-*-* } } } */
/* { dg-final { scan-assembler-not {vmv4r} } } */
/* { dg-final { scan-assembler-not {vmv8r} } } */
/* { dg-final { scan-assembler-not {csrr} } } */
/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */
2 changes: 1 addition & 1 deletion gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-40.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ foo2 (void *in, void *out, int n)
/* { dg-final { scan-assembler-not {vmv2r} } } */
/* { dg-final { scan-assembler-not {vmv4r} { xfail riscv*-*-* } } } */
/* { dg-final { scan-assembler-not {vmv8r} } } */
/* { dg-final { scan-assembler-not {csrr} } } */
/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */
2 changes: 1 addition & 1 deletion gcc/testsuite/gcc.target/riscv/rvv/base/pr112431-41.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ foo2 (void *in, void *out, int n)
/* { dg-final { scan-assembler-not {vmv2r} } } */
/* { dg-final { scan-assembler-not {vmv4r} } } */
/* { dg-final { scan-assembler-not {vmv8r} { xfail riscv*-*-* } } } */
/* { dg-final { scan-assembler-not {csrr} } } */
/* { dg-final { scan-assembler-not {csrr} { xfail riscv*-*-* } } } */

0 comments on commit bc17a92

Please sign in to comment.