summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/memory-arm64-ion-codegen.js
blob: 48ad75aa118dfd0402a833fa4485fcbbdcb15c77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// |jit-test| skip-if: !hasDisassembler() || wasmCompileMode() != "ion" || !getBuildConfiguration().arm64; include:codegen-arm64-test.js

// Test that loads/stores at friendly constant offsets yield expected code

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (result i32)
         (i32.load (i32.const 4000))))`,
    'f',
    'b94fa2a0  ldr  w0, \\[x21, #4000\\]');

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (result i32)
         (i32.load offset=1000 (i32.const 3000))))`,
    'f',
    'b94fa2a0  ldr  w0, \\[x21, #4000\\]');

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (param i32)
         (i32.store (i32.const 4000) (local.get 0))))`,
    'f',
    'b90fa2a0  str w0, \\[x21, #4000\\]');

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (param i32)
         (i32.store offset=1000 (i32.const 3000) (local.get 0))))`,
    'f',
    'b90fa2a0  str w0, \\[x21, #4000\\]');

// Unfriendly offsets are first loaded into a scratch register

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (result i32)
         (i32.load (i32.const 4001))))`,
    'f',
    `d281f430  mov     x16, #0xfa1
     b8706aa0  ldr     w0, \\[x21, x16\\]`);

codegenTestARM64_adhoc(
    `(module
       (memory 1)
       (func (export "f") (param i32)
         (i32.store (i32.const 4001) (local.get 0))))`,
    'f',
    `d281f430  mov     x16, #0xfa1
     b8306aa0  str     w0, \\[x21, x16\\]`);