Skip to content

PCC [AArch64]: load_constant64_full generates incorrect fact range for 32-bit MOVN#7699

Merged
fitzgen merged 1 commit into
bytecodealliance:mainfrom
feilongjiang:fix_arm64_pcc_on_32bit_movn
Dec 20, 2023
Merged

PCC [AArch64]: load_constant64_full generates incorrect fact range for 32-bit MOVN#7699
fitzgen merged 1 commit into
bytecodealliance:mainfrom
feilongjiang:fix_arm64_pcc_on_32bit_movn

Conversation

@feilongjiang
Copy link
Copy Markdown
Contributor

Hi team, find another PCC fact range issue on AArch64.
When the top 32 bits of the value are zero and the upper_halfword of the lower 32 bits is u16::MAX, load_constant64_full will emit a single movn instruction. In that case, add_range_fact only adds lower_halfword as the fact range, which misses the upper halfword value. We should add the hole 32-bit value as the fact range.

Here is a simple test to reproduce the issue:

;; test_const.wat
(module
  (func (export "test_constant") (result i64) (i64.const 0xfffffff7))
)

Step to reproduce:

Compile the test with PCC on:

target/debug/wasmtime compile -C pcc=y test_const.wat

the output will be:

Error: Compilation error: Proof-carrying-code validation error: UnsupportedFact

…r 32-bit MOVN

When the top 32 bits of the value are zero and the upper_halfword of the lower
32 bits is u16::MAX, load_constant64_full will emit a single `movn` instruction.
In that case, add_range_fact only adds lower_halfword as the fact range, which
misses the upper halfword value. We should add the hole 32-bit value as the
fact range.
@feilongjiang feilongjiang requested a review from a team as a code owner December 18, 2023 09:03
@feilongjiang feilongjiang requested review from abrown and removed request for a team December 18, 2023 09:03
@feilongjiang
Copy link
Copy Markdown
Contributor Author

Hi @fitzgen, would you please take a look?

@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:area:aarch64 Issues related to AArch64 backend. isle Related to the ISLE domain-specific language labels Dec 18, 2023
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @cfallin, @fitzgen

Details This issue or pull request has been labeled: "cranelift", "cranelift:area:aarch64", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

Thanks!

@fitzgen fitzgen added this pull request to the merge queue Dec 20, 2023
Merged via the queue into bytecodealliance:main with commit d622ffc Dec 20, 2023
@feilongjiang feilongjiang deleted the fix_arm64_pcc_on_32bit_movn branch December 21, 2023 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:aarch64 Issues related to AArch64 backend. cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants