Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64-SVE: Implement IF_SVE_BV_2A #99049

Merged
merged 7 commits into from
Mar 5, 2024
Merged

Conversation

a74nh
Copy link
Contributor

@a74nh a74nh commented Feb 28, 2024

Part of #94549. Adds IF_SVE_BV_2A, IF_SVE_BV_2A_A and IF_SVE_BV_2A_J.

coreclr:

mov z15.b, p5/z, #0
mov z5.b, p15/z, #27
mov z31.b, p0/z, #-128
mov z0.b, p5/z, #127
mov z15.h, p5/z, #0
mov z23.s, p12/z, #10
mov z4.d, p0/z, #-128
mov z19.h, p15/z, #127
mov z1.s, p0/z, #1, LSL #8
mov z1.d, p0/z, #12, LSL #8
mov z1.h, p0/z, #-12, LSL #8
mov z1.s, p0/z, #-128, LSL #8
mov z0.d, p0/z, #127, LSL #8
mov z1.b, p12/m, #5
mov z27.h, p13/m, #22, LSL #8
mov z27.h, p13/m, #-22, LSL #8

Capstone

0F001505  mov   z15.b, p5/z, #0
65031F05  mov   z5.b, p15/z, #0x1B
1F101005  mov   z31.b, p0/z, #-0x80
E00F1505  mov   z0.b, p5/z, #0x7F
0F005505  mov   z15.h, p5/z, #0
57019C05  mov   z23.s, p12/z, #0xA
0410D005  mov   z4.d, p0/z, #0x80
F30F5F05  mov   z19.h, p15/z, #0x7F
21209005  mov   z1.s, p0/z, #0x100
8121D005  mov   z1.d, p0/z, #0xC00
813E5005  mov   z1.h, p0/z, #-0xC00
01309005  mov   z1.s, p0/z, #0x8000
E02FD005  mov   z0.d, p0/z, #0x7F00
A1401C05  mov   z1.b, p12/m, #5
DB625D05  mov   z27.h, p13/m, #0x1600
5B7D5D05  mov   z27.h, p13/m, #-0x1600

Ignoring the differences in immediate formatting (decimal + shift vs hex), there are two errors with -ve numbers in coreclr being positive in capstone

To check this, I ran in gdb and got:

   0x0000ffffa98b394c:	mov	z15.b, p5/z, #0
   0x0000ffffa98b3950:	mov	z5.b, p15/z, #27
   0x0000ffffa98b3954:	mov	z31.b, p0/z, #-128
   0x0000ffffa98b3958:	mov	z0.b, p5/z, #127
   0x0000ffffa98b395c:	mov	z15.h, p5/z, #0
   0x0000ffffa98b3960:	mov	z23.s, p12/z, #10
   0x0000ffffa98b3964:	mov	z4.d, p0/z, #-128
   0x0000ffffa98b3968:	mov	z19.h, p15/z, #127
   0x0000ffffa98b396c:	mov	z1.s, p0/z, #256
   0x0000ffffa98b3970:	mov	z1.d, p0/z, #3072
   0x0000ffffa98b3974:	mov	z1.h, p0/z, #-3072
   0x0000ffffa98b3978:	mov	z1.s, p0/z, #-32768
   0x0000ffffa98b397c:	mov	z0.d, p0/z, #32512
   0x0000ffffa98b3980:	mov	z1.b, p12/m, #5
   0x0000ffffa98b3984:	mov	z27.h, p13/m, #5632
   0x0000ffffa98b3988:	mov	z27.h, p13/m, #-5632

In summary:

coreclr:     mov z4.d, p0/z, #-128
capstone: mov   z4.d, p0/z, #0x80
gdb:          mov	z4.d, p0/z, #-128

coreclr :    mov z1.s, p0/z, #-128, LSL #8
capstone: mov   z1.s, p0/z, #0x8000
gdb:          mov	z1.s, p0/z, #-32768

I'm happy this is an error in capstone and that coreclr+gdb are correct.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 28, 2024
@ghost
Copy link

ghost commented Feb 28, 2024

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Part of #94549. Adds IF_SVE_BV_2A, IF_SVE_BV_2A_A and IF_SVE_BV_2A_J.

coreclr:

mov z15.b, p5/z, #0
mov z5.b, p15/z, #27
mov z31.b, p0/z, #-128
mov z0.b, p5/z, #127
mov z15.h, p5/z, #0
mov z23.s, p12/z, #10
mov z4.d, p0/z, #-128
mov z19.h, p15/z, #127
mov z1.s, p0/z, #1, LSL #8
mov z1.d, p0/z, #12, LSL #8
mov z1.h, p0/z, #-12, LSL #8
mov z1.s, p0/z, #-128, LSL #8
mov z0.d, p0/z, #127, LSL #8
mov z1.b, p12/m, #5
mov z27.h, p13/m, #22, LSL #8
mov z27.h, p13/m, #-22, LSL #8

Capstone

0F001505  mov   z15.b, p5/z, #0
65031F05  mov   z5.b, p15/z, #0x1B
1F101005  mov   z31.b, p0/z, #-0x80
E00F1505  mov   z0.b, p5/z, #0x7F
0F005505  mov   z15.h, p5/z, #0
57019C05  mov   z23.s, p12/z, #0xA
0410D005  mov   z4.d, p0/z, #0x80
F30F5F05  mov   z19.h, p15/z, #0x7F
21209005  mov   z1.s, p0/z, #0x100
8121D005  mov   z1.d, p0/z, #0xC00
813E5005  mov   z1.h, p0/z, #-0xC00
01309005  mov   z1.s, p0/z, #0x8000
E02FD005  mov   z0.d, p0/z, #0x7F00
A1401C05  mov   z1.b, p12/m, #5
DB625D05  mov   z27.h, p13/m, #0x1600
5B7D5D05  mov   z27.h, p13/m, #-0x1600

Ignoring the differences in immediate formatting (decimal + shift vs hex), there are two errors with -ve numbers in coreclr being positive in capstone

To check this, I ran in gdb and got:

   0x0000ffffa98b394c:	mov	z15.b, p5/z, #0
   0x0000ffffa98b3950:	mov	z5.b, p15/z, #27
   0x0000ffffa98b3954:	mov	z31.b, p0/z, #-128
   0x0000ffffa98b3958:	mov	z0.b, p5/z, #127
   0x0000ffffa98b395c:	mov	z15.h, p5/z, #0
   0x0000ffffa98b3960:	mov	z23.s, p12/z, #10
   0x0000ffffa98b3964:	mov	z4.d, p0/z, #-128
   0x0000ffffa98b3968:	mov	z19.h, p15/z, #127
   0x0000ffffa98b396c:	mov	z1.s, p0/z, #256
   0x0000ffffa98b3970:	mov	z1.d, p0/z, #3072
   0x0000ffffa98b3974:	mov	z1.h, p0/z, #-3072
   0x0000ffffa98b3978:	mov	z1.s, p0/z, #-32768
   0x0000ffffa98b397c:	mov	z0.d, p0/z, #32512
   0x0000ffffa98b3980:	mov	z1.b, p12/m, #5
   0x0000ffffa98b3984:	mov	z27.h, p13/m, #5632
   0x0000ffffa98b3988:	mov	z27.h, p13/m, #-5632

In summary:

coreclr:     mov z4.d, p0/z, #-128
capstone: mov   z4.d, p0/z, #0x80
gdb:          mov	z4.d, p0/z, #-128

coreclr :    mov z1.s, p0/z, #-128, LSL #8
capstone: mov   z1.s, p0/z, #0x8000
gdb:          mov	z1.s, p0/z, #-32768

I'm happy this is an error in capstone and that coreclr+gdb are correct.

Author: a74nh
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@a74nh
Copy link
Contributor Author

a74nh commented Feb 28, 2024

@dotnet/jit-contrib @dotnet/arm64-contrib @a74nh @kunalspathak this is ready.

@a74nh a74nh marked this pull request as ready for review February 28, 2024 14:56
@a74nh
Copy link
Contributor Author

a74nh commented Feb 28, 2024

Note - I wasn't due to do this, but, I needed it for #98218

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@kunalspathak kunalspathak added the arm-sve Work related to arm64 SVE/SVE2 support label Feb 28, 2024
src/coreclr/jit/emitarm64.cpp Outdated Show resolved Hide resolved
src/coreclr/jit/emitarm64.cpp Outdated Show resolved Hide resolved
INS_OPTS_SCALABLE_D); // MOV <Zd>.<T>, <Pg>/Z, #<imm>{, <shift>}

// IF_SVE_BV_2A_A
theEmitter->emitIns_R_R_I(INS_sve_cpy, EA_SCALABLE, REG_V1, REG_P12, 5, INS_OPTS_SCALABLE_B,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be removed I assume?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do it in a follow-up PR though.

@kunalspathak kunalspathak merged commit 605dc6c into dotnet:main Mar 5, 2024
129 checks passed
@a74nh a74nh deleted the IF_SVE_BV_2A_github branch March 6, 2024 12:14
@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI arm-sve Work related to arm64 SVE/SVE2 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants