xref: /aosp_15_r20/external/llvm/test/MC/Mips/expr1.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc  %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -show-encoding | \
2*9880d681SAndroid Build Coastguard Worker# RUN:   FileCheck %s --check-prefix=32R2-EL
3*9880d681SAndroid Build Coastguard Worker# RUN: llvm-mc  %s -triple=mipsel-unknown-linux -mcpu=mips32r2 -mattr=micromips -show-encoding | \
4*9880d681SAndroid Build Coastguard Worker# RUN:   FileCheck %s --check-prefix=MM-32R2-EL
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker# Check that the assembler can handle the expressions as operands.
7*9880d681SAndroid Build Coastguard Worker# 32R2-EL: .text
8*9880d681SAndroid Build Coastguard Worker# 32R2-EL: .globl  foo
9*9880d681SAndroid Build Coastguard Worker# 32R2-EL: foo:
10*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, %lo(foo)($4)       # encoding: [A,A,0x84,0x8c]
11*9880d681SAndroid Build Coastguard Worker# 32R2-EL:                             #   fixup A - offset: 0, value: %lo(foo), kind: fixup_Mips_LO16
12*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, 56($4)             # encoding: [0x38,0x00,0x84,0x8c]
13*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, %lo(8+foo)($4)     # encoding: [A,A,0x84,0x8c]
14*9880d681SAndroid Build Coastguard Worker# 32R2-EL:                             #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_Mips_LO16
15*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, %lo(8+foo)($4)     # encoding: [A,A,0x84,0x8c]
16*9880d681SAndroid Build Coastguard Worker# 32R2-EL:                             #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_Mips_LO16
17*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, %lo(8+foo)($4)     # encoding: [A,A,0x84,0x8c]
18*9880d681SAndroid Build Coastguard Worker# 32R2-EL:                             #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_Mips_LO16
19*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, 10($4)             # encoding: [0x0a,0x00,0x84,0x8c]
20*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, 15($4)             # encoding: [0x0f,0x00,0x84,0x8c]
21*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, 21($4)             # encoding: [0x15,0x00,0x84,0x8c]
22*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, 28($4)             # encoding: [0x1c,0x00,0x84,0x8c]
23*9880d681SAndroid Build Coastguard Worker# 32R2-EL: lw   $4, %lo(65542)($4)     # encoding: [0x06,0x00,0x84,0x8c]
24*9880d681SAndroid Build Coastguard Worker# 32R2-EL: .space  64
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: .text
27*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: .globl  foo
28*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: foo:
29*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, %lo(foo)($4)     # encoding: [0x84'A',0xfc'A',0x00,0x00]
30*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL:                           #   fixup A - offset: 0, value: %lo(foo), kind: fixup_MICROMIPS_LO16
31*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, 56($4)           # encoding: [0x84,0xfc,0x38,0x00]
32*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, %lo(8+foo)($4)   # encoding: [0x84'A',0xfc'A',0x00,0x00]
33*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL:                           #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_MICROMIPS_LO16
34*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, %lo(8+foo)($4)   # encoding: [0x84'A',0xfc'A',0x00,0x00]
35*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL:                           #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_MICROMIPS_LO16
36*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, %lo(8+foo)($4)   # encoding: [0x84'A',0xfc'A',0x00,0x00]
37*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL:                           #   fixup A - offset: 0, value: %lo(8+foo), kind: fixup_MICROMIPS_LO16
38*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, 10($4)           # encoding: [0x84,0xfc,0x0a,0x00]
39*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, 15($4)           # encoding: [0x84,0xfc,0x0f,0x00]
40*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, 21($4)           # encoding: [0x84,0xfc,0x15,0x00]
41*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, 28($4)           # encoding: [0x84,0xfc,0x1c,0x00]
42*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: lw   $4, %lo(65542)($4)   # encoding: [0x84,0xfc,0x06,0x00]
43*9880d681SAndroid Build Coastguard Worker# MM-32R2-EL: .space  64
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker  .globl  foo
46*9880d681SAndroid Build Coastguard Worker  .ent  foo
47*9880d681SAndroid Build Coastguard Workerfoo:
48*9880d681SAndroid Build Coastguard Worker  lw  $4,%lo(foo)($4)
49*9880d681SAndroid Build Coastguard Worker  lw  $4,((10 + 4) * 4)($4)
50*9880d681SAndroid Build Coastguard Worker  lw  $4,%lo (2 * 4) + foo($4)
51*9880d681SAndroid Build Coastguard Worker  lw  $4,%lo((2 * 4) + foo)($4)
52*9880d681SAndroid Build Coastguard Worker  lw  $4,(((%lo ((2 * 4) + foo))))($4)
53*9880d681SAndroid Build Coastguard Worker  lw  $4, (((1+2)+3)+4)($4)
54*9880d681SAndroid Build Coastguard Worker  lw  $4, ((((1+2)+3)+4)+5)($4)
55*9880d681SAndroid Build Coastguard Worker  lw  $4, (((((1+2)+3)+4)+5)+6)($4)
56*9880d681SAndroid Build Coastguard Worker  lw  $4, ((((((1+2)+3)+4)+5)+6)+7)($4)
57*9880d681SAndroid Build Coastguard Worker  lw  $4, (%lo((1+2)+65536)+3)($4)
58*9880d681SAndroid Build Coastguard Worker  .space  64
59*9880d681SAndroid Build Coastguard Worker  .end  foo
60