Debian Codegraph @

js/src/jit-test/tests/wasm/memory-arm64-ion-codegen.js

raw
1 // |jit-test| skip-if: !hasDisassembler() || wasmCompileMode() != "ion" || !getBuildConfiguration("arm64"); include:codegen-arm64-test.js
2
3 // Test that loads/stores at friendly constant offsets yield expected code
4
5 codegenTestARM64_adhoc(
6 `(module
7 (memory 1)
8 (func (export "f") (result i32)
9 (i32.load (i32.const 4000))))`,
10 'f',
11 'b94fa2a0 ldr w0, \\[x21, #4000\\]');
12
13 codegenTestARM64_adhoc(
14 `(module
15 (memory 1)
16 (func (export "f") (result i32)
17 (i32.load offset=1000 (i32.const 3000))))`,
18 'f',
19 'b94fa2a0 ldr w0, \\[x21, #4000\\]');
20
21 codegenTestARM64_adhoc(
22 `(module
23 (memory 1)
24 (func (export "f") (param i32)
25 (i32.store (i32.const 4000) (local.get 0))))`,
26 'f',
27 'b90fa2a0 str w0, \\[x21, #4000\\]');
28
29 codegenTestARM64_adhoc(
30 `(module
31 (memory 1)
32 (func (export "f") (param i32)
33 (i32.store offset=1000 (i32.const 3000) (local.get 0))))`,
34 'f',
35 'b90fa2a0 str w0, \\[x21, #4000\\]');
36
37 // Unfriendly offsets are first loaded into a scratch register
38
39 codegenTestARM64_adhoc(
40 `(module
41 (memory 1)
42 (func (export "f") (result i32)
43 (i32.load (i32.const 4001))))`,
44 'f',
45 `d281f430 mov x16, #0xfa1
46 b8706aa0 ldr w0, \\[x21, x16\\]`);
47
48 codegenTestARM64_adhoc(
49 `(module
50 (memory 1)
51 (func (export "f") (param i32)
52 (i32.store (i32.const 4001) (local.get 0))))`,
53 'f',
54 `d281f430 mov x16, #0xfa1
55 b8306aa0 str w0, \\[x21, x16\\]`);
56