public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Remove movmisalign pattern for VLA modes
@ 2023-08-29  9:39 Juzhe-Zhong
  2023-08-29 13:48 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Juzhe-Zhong @ 2023-08-29  9:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, kito.cheng, jeffreyalaw, rdapp.gcc, Juzhe-Zhong

This patch fixed this bunch of failures in "vect" testsuite:
FAIL: gcc.dg/vect/pr63341-1.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr63341-1.c execution test
FAIL: gcc.dg/vect/pr63341-2.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr63341-2.c execution test
FAIL: gcc.dg/vect/pr94994.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr94994.c execution test
FAIL: gcc.dg/vect/vect-align-1.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/vect-align-1.c execution test
FAIL: gcc.dg/vect/vect-align-2.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/vect-align-2.c execution test

Spike report:
z  0000000000000000 ra 00000000000100f4 sp 0000003ffffffb30 gp 0000000000012cc8
tp 0000000000000000 t0 00000000000102d4 t1 000000000000000f t2 0000000000000000
s0 0000000000000000 s1 0000000000000000 a0 00000000000101a6 a1 0000000000000008
a2 0000000000000010 a3 0000000000012401 a4 0000000000012480 a5 0000000000000020
a6 000000000000001f a7 00000000000000d6 s2 0000000000000000 s3 0000000000000000
s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000
s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000
t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000
pc 00000000000101ec va/inst 000000000206dc07 sr 8000000200006620
Load access fault!

(spike)
core   0: 0x0000000000010204 (0x02065087) vle16.v v1, (a2)
core   0: exception trap_load_address_misaligned, epc 0x0000000000010204
core   0:           tval 0x0000000000012c81
(spike) reg 0 a2
0x0000000000012c81

According to RVV ISA, we couldn't use "vle16.v" if the address is byte align.

Such issue is caused by this GIMPLE IR:

vect__1.15_17 = .MASK_LEN_LOAD (vectp_t.13_15, 8B, { -1, ... }, _24, 0);

For partial vectorization, the alignment is "8B" byte align here is incorrect here.

After this patch, the vectorization failed:

sll     a5,a4,0x1
add     a5,a5,a1
lhu     a3,64(a5)
lbu     a5,66(a5)
addw    a4,a4,1
srl     a3,a3,0x8
sll     a5,a5,0x8
or      a5,a5,a3
sh      a5,0(a2)
add     a2,a2,2
bne     a4,a0,101f8 <foo+0x14>

I will enable auto-vectorization in another approach in the next following patch.

gcc/ChangeLog:

	* config/riscv/autovec.md (movmisalign<mode>): Delete.

---
 gcc/config/riscv/autovec.md | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/gcc/config/riscv/autovec.md b/gcc/config/riscv/autovec.md
index 20ab0693b98..07e46d6ce49 100644
--- a/gcc/config/riscv/autovec.md
+++ b/gcc/config/riscv/autovec.md
@@ -46,17 +46,6 @@
   DONE;
 })
 
-(define_expand "movmisalign<mode>"
-  [(set (match_operand:V 0 "nonimmediate_operand")
-	(match_operand:V 1 "general_operand"))]
-  "TARGET_VECTOR"
-  {
-    /* Equivalent to a normal move for our purpooses.  */
-    emit_move_insn (operands[0], operands[1]);
-    DONE;
-  }
-)
-
 ;; =========================================================================
 ;; == Gather Load
 ;; =========================================================================
-- 
2.36.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Remove movmisalign pattern for VLA modes
  2023-08-29  9:39 [PATCH] RISC-V: Remove movmisalign pattern for VLA modes Juzhe-Zhong
@ 2023-08-29 13:48 ` Jeff Law
  2023-08-30 10:48   ` Lehua Ding
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-08-29 13:48 UTC (permalink / raw)
  To: Juzhe-Zhong, gcc-patches; +Cc: kito.cheng, kito.cheng, rdapp.gcc



On 8/29/23 03:39, Juzhe-Zhong wrote:
> This patch fixed this bunch of failures in "vect" testsuite:
> FAIL: gcc.dg/vect/pr63341-1.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/pr63341-1.c execution test
> FAIL: gcc.dg/vect/pr63341-2.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/pr63341-2.c execution test
> FAIL: gcc.dg/vect/pr94994.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/pr94994.c execution test
> FAIL: gcc.dg/vect/vect-align-1.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/vect-align-1.c execution test
> FAIL: gcc.dg/vect/vect-align-2.c -flto -ffat-lto-objects execution test
> FAIL: gcc.dg/vect/vect-align-2.c execution test
> 
> Spike report:
> z  0000000000000000 ra 00000000000100f4 sp 0000003ffffffb30 gp 0000000000012cc8
> tp 0000000000000000 t0 00000000000102d4 t1 000000000000000f t2 0000000000000000
> s0 0000000000000000 s1 0000000000000000 a0 00000000000101a6 a1 0000000000000008
> a2 0000000000000010 a3 0000000000012401 a4 0000000000012480 a5 0000000000000020
> a6 000000000000001f a7 00000000000000d6 s2 0000000000000000 s3 0000000000000000
> s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000
> s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000
> t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000
> pc 00000000000101ec va/inst 000000000206dc07 sr 8000000200006620
> Load access fault!
> 
> (spike)
> core   0: 0x0000000000010204 (0x02065087) vle16.v v1, (a2)
> core   0: exception trap_load_address_misaligned, epc 0x0000000000010204
> core   0:           tval 0x0000000000012c81
> (spike) reg 0 a2
> 0x0000000000012c81
> 
> According to RVV ISA, we couldn't use "vle16.v" if the address is byte align.
> 
> Such issue is caused by this GIMPLE IR:
> 
> vect__1.15_17 = .MASK_LEN_LOAD (vectp_t.13_15, 8B, { -1, ... }, _24, 0);
> 
> For partial vectorization, the alignment is "8B" byte align here is incorrect here.
> 
> After this patch, the vectorization failed:
> 
> sll     a5,a4,0x1
> add     a5,a5,a1
> lhu     a3,64(a5)
> lbu     a5,66(a5)
> addw    a4,a4,1
> srl     a3,a3,0x8
> sll     a5,a5,0x8
> or      a5,a5,a3
> sh      a5,0(a2)
> add     a2,a2,2
> bne     a4,a0,101f8 <foo+0x14>
> 
> I will enable auto-vectorization in another approach in the next following patch.
> 
> gcc/ChangeLog:
> 
> 	* config/riscv/autovec.md (movmisalign<mode>): Delete.
OK.
jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Remove movmisalign pattern for VLA modes
  2023-08-29 13:48 ` Jeff Law
@ 2023-08-30 10:48   ` Lehua Ding
  0 siblings, 0 replies; 3+ messages in thread
From: Lehua Ding @ 2023-08-30 10:48 UTC (permalink / raw)
  To: Jeff Law, Juzhe-Zhong, gcc-patches; +Cc: kito.cheng, kito.cheng

Committed, thanks Jeff.

On 2023/8/29 21:48, Jeff Law via Gcc-patches wrote:
> 
> 
> On 8/29/23 03:39, Juzhe-Zhong wrote:
>> This patch fixed this bunch of failures in "vect" testsuite:
>> FAIL: gcc.dg/vect/pr63341-1.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/pr63341-1.c execution test
>> FAIL: gcc.dg/vect/pr63341-2.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/pr63341-2.c execution test
>> FAIL: gcc.dg/vect/pr94994.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/pr94994.c execution test
>> FAIL: gcc.dg/vect/vect-align-1.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/vect-align-1.c execution test
>> FAIL: gcc.dg/vect/vect-align-2.c -flto -ffat-lto-objects execution test
>> FAIL: gcc.dg/vect/vect-align-2.c execution test
>>
>> Spike report:
>> z  0000000000000000 ra 00000000000100f4 sp 0000003ffffffb30 gp 
>> 0000000000012cc8
>> tp 0000000000000000 t0 00000000000102d4 t1 000000000000000f t2 
>> 0000000000000000
>> s0 0000000000000000 s1 0000000000000000 a0 00000000000101a6 a1 
>> 0000000000000008
>> a2 0000000000000010 a3 0000000000012401 a4 0000000000012480 a5 
>> 0000000000000020
>> a6 000000000000001f a7 00000000000000d6 s2 0000000000000000 s3 
>> 0000000000000000
>> s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 
>> 0000000000000000
>> s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 
>> 0000000000000000
>> t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 
>> 0000000000000000
>> pc 00000000000101ec va/inst 000000000206dc07 sr 8000000200006620
>> Load access fault!
>>
>> (spike)
>> core   0: 0x0000000000010204 (0x02065087) vle16.v v1, (a2)
>> core   0: exception trap_load_address_misaligned, epc 0x0000000000010204
>> core   0:           tval 0x0000000000012c81
>> (spike) reg 0 a2
>> 0x0000000000012c81
>>
>> According to RVV ISA, we couldn't use "vle16.v" if the address is byte 
>> align.
>>
>> Such issue is caused by this GIMPLE IR:
>>
>> vect__1.15_17 = .MASK_LEN_LOAD (vectp_t.13_15, 8B, { -1, ... }, _24, 0);
>>
>> For partial vectorization, the alignment is "8B" byte align here is 
>> incorrect here.
>>
>> After this patch, the vectorization failed:
>>
>> sll     a5,a4,0x1
>> add     a5,a5,a1
>> lhu     a3,64(a5)
>> lbu     a5,66(a5)
>> addw    a4,a4,1
>> srl     a3,a3,0x8
>> sll     a5,a5,0x8
>> or      a5,a5,a3
>> sh      a5,0(a2)
>> add     a2,a2,2
>> bne     a4,a0,101f8 <foo+0x14>
>>
>> I will enable auto-vectorization in another approach in the next 
>> following patch.
>>
>> gcc/ChangeLog:
>>
>>     * config/riscv/autovec.md (movmisalign<mode>): Delete.
> OK.
> jeff

-- 
Best,
Lehua


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-30 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29  9:39 [PATCH] RISC-V: Remove movmisalign pattern for VLA modes Juzhe-Zhong
2023-08-29 13:48 ` Jeff Law
2023-08-30 10:48   ` Lehua Ding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).