Skip to content

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.

@ghost ghost 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

@a74nh a74nh force-pushed the IF_SVE_BV_2A_github branch from 438a75e to 5715615 Compare February 28, 2024 15:01
Copy link
Contributor

@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
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
Contributor

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
Contributor

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
@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