Skip to content

Commit 6486dec

Browse files
arcv: Disable *<any_extract...>3 when fusion is available
This define_insn_and_split prevents *zero_extract_fused from being selected. Updated the test. It succeeded despite the fused case not being selected because the right instructions were produced still. Signed-off-by: Michiel Derhaeg <michiel@synopsys.com>
1 parent 9ce9c29 commit 6486dec

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

gcc/config/riscv/iterators.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@
218218
(zero_extract "srliw")])
219219
(define_code_attr extract_shift [(sign_extract "ashiftrt")
220220
(zero_extract "lshiftrt")])
221+
(define_code_attr is_zero_extract [(sign_extract "false")
222+
(zero_extract "true")])
221223

222224
;; This code iterator allows the two right shift instructions to be
223225
;; generated from the same template.

gcc/config/riscv/riscv.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3125,6 +3125,7 @@
31253125
;; * Single-bit extraction (SFB)
31263126
;; * Extraction instruction th.ext(u) (XTheadBb)
31273127
;; * lshrsi3_extend_2 (see above)
3128+
;; * Zero extraction fusion (ARC-V)
31283129
(define_insn_and_split "*<any_extract:optab><GPR:mode>3"
31293130
[(set (match_operand:GPR 0 "register_operand" "=r")
31303131
(any_extract:GPR
@@ -3137,6 +3138,8 @@
31373138
&& (INTVAL (operands[2]) == 1))
31383139
&& !TARGET_XTHEADBB
31393140
&& !TARGET_XANDESPERF
3141+
&& !(riscv_is_micro_arch (arcv_rhx100)
3142+
&& <any_extract:is_zero_extract>)
31403143
&& !(TARGET_64BIT
31413144
&& (INTVAL (operands[3]) > 0)
31423145
&& (INTVAL (operands[2]) + INTVAL (operands[3]) == 32))"
@@ -4624,7 +4627,7 @@
46244627
(match_operand:SI 2 "register_operand" "r,r"))
46254628
(match_operand:SI 3 "register_operand" "r,?0"))))
46264629
(clobber (match_scratch:SI 4 "=&r,&r"))]
4627-
"arcv_micro_arch_supports_fusion_p ()
4630+
"riscv_is_micro_arch (arcv_rhx100)
46284631
&& (TARGET_ZMMUL || TARGET_MUL)"
46294632
{
46304633
if (REGNO (operands[0]) == REGNO (operands[3]))

gcc/doc/riscv-mtune.texi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ particular CPU name. Permissible values for this option are:
5252

5353
@samp{arc-v-rmx-100-series},
5454

55+
@samp{arc-v-rhx-100-series},
56+
5557
@samp{generic-ooo},
5658

5759
@samp{size},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* { dg-do compile } */
22
/* { dg-require-effective-target rv32 } */
33
/* { dg-skip-if "" { *-*-* } { "-g" "-flto" "-O0" "-Oz" "-Os" } } */
4-
/* { dg-options "-mtune=arc-v-rhx-100-series -march=rv32im_zbs -mabi=ilp32" } */
4+
/* { dg-options "-mtune=arc-v-rhx-100-series -march=rv32im_zbs -mabi=ilp32 -dp" } */
55

66
#define bit_extract(x,start,amt) (((x)>>(start)) & (~(0xffffffff << (amt))))
77

@@ -11,4 +11,4 @@ f (int x)
1111
return bit_extract(x,10,14) + bit_extract(x,1,1);
1212
}
1313

14-
/* { dg-final { scan-assembler {\sslli\s([ast][0-9]+),a0,8\n\ssrli\s([ast][0-9]+),\1,18\n\sbexti\sa0,a0,1\n\sadd\sa0,\2,a0\n} } } */
14+
/* { dg-final { scan-assembler {\sslli\s([ast][0-9]+),a0,8.*zero_extract_fused\n\ssrli\s([ast][0-9]+),\1,18\n\sbexti\sa0,a0,1.*\n\sadd\sa0,\2,a0.*\n} } } */

0 commit comments

Comments
 (0)