Skip to content

arm64: support register-extend operands#13

Merged
cpunion merged 2 commits intoxgo-dev:mainfrom
cpunion:fix/arm64-reg-extend
Mar 27, 2026
Merged

arm64: support register-extend operands#13
cpunion merged 2 commits intoxgo-dev:mainfrom
cpunion:fix/arm64-reg-extend

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented Mar 27, 2026

Summary

  • add parser support for arm64 register-extend operands like R2.UXTB
  • lower register-extend operands in arm64 eval so CMP R2.UXTB, R5 translates directly
  • add parser/eval/translate coverage for the new operand form

Why

Go 1.26's internal/bytealg/count_arm64.s uses CMP R2.UXTB, R5.
llgo was carrying a downstream source rewrite to normalize that operand before translation. This change moves the support into plan9asm so downstream users can translate the stdlib source as-is.

Testing

  • go test ./...
  • go test ./... -run 'TestStdlibInternalBytealg_ARM64_Compile'

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 92.15686% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.55%. Comparing base (33e8ba1) to head (e71ba40).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
arm64_eval.go 93.54% 1 Missing and 1 partial ⚠️
types.go 90.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
+ Coverage   69.48%   69.55%   +0.07%     
==========================================
  Files          57       57              
  Lines       16380    16431      +51     
==========================================
+ Hits        11382    11429      +47     
- Misses       3683     3685       +2     
- Partials     1315     1317       +2     
Flag Coverage Δ
unittests 69.55% <92.15%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements support for ARM64 register extensions (e.g., R2.UXTB) by introducing the OpRegExtend operand kind. The changes include updates to the operand parser, string representation, and the evaluation logic to generate appropriate truncation and extension IR. Feedback was provided to optimize the parseRegExtend function by avoiding redundant string transformations.

Comment thread types.go Outdated
Comment thread types.go Outdated
Comment thread types.go Outdated
Comment thread types.go
@fennoai
Copy link
Copy Markdown

fennoai Bot commented Mar 27, 2026

Clean, well-scoped addition. The parser, eval, and String() all follow existing codebase patterns closely, and test coverage is solid (edge cases, round-trip, stdlib integration). Three minor items inline: a duplicated string expression in parseRegExtend, a missing // OpRegExtend annotation on Operand.Ext, and a missing doc comment on the new public ExtendOp type.

@cpunion cpunion merged commit ec1a30b into xgo-dev:main Mar 27, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant