1# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r2 | \ 2# RUN: FileCheck %s 3# RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r6 | \ 4# RUN: FileCheck %s 5 6.set mips64r2 7 8dla $5, 0x00000001 # CHECK: addiu $5, $zero, 1 # encoding: [0x24,0x05,0x00,0x01] 9dla $5, 0x00000002 # CHECK: addiu $5, $zero, 2 # encoding: [0x24,0x05,0x00,0x02] 10dla $5, 0x00004000 # CHECK: addiu $5, $zero, 16384 # encoding: [0x24,0x05,0x40,0x00] 11dla $5, 0x00008000 # CHECK: ori $5, $zero, 32768 # encoding: [0x34,0x05,0x80,0x00] 12dla $5, 0xffffffff # CHECK: addiu $5, $zero, -1 # encoding: [0x24,0x05,0xff,0xff] 13dla $5, 0xfffffffe # CHECK: addiu $5, $zero, -2 # encoding: [0x24,0x05,0xff,0xfe] 14dla $5, 0xffffc000 # CHECK: addiu $5, $zero, -16384 # encoding: [0x24,0x05,0xc0,0x00] 15dla $5, 0xffff8000 # CHECK: addiu $5, $zero, -32768 # encoding: [0x24,0x05,0x80,0x00] 16 17dla $5, 0x00010000 # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 18dla $5, 0x00020000 # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 19dla $5, 0x40000000 # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 20dla $5, 0x80000000 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 21dla $5, 0xffff0000 # CHECK: lui $5, 65535 # encoding: [0x3c,0x05,0xff,0xff] 22dla $5, 0xfffe0000 # CHECK: lui $5, 65534 # encoding: [0x3c,0x05,0xff,0xfe] 23dla $5, 0xc0000000 # CHECK: lui $5, 49152 # encoding: [0x3c,0x05,0xc0,0x00] 24dla $5, 0x80000000 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 25 26dla $5, 0x00010001 # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 27 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 28dla $5, 0x00020001 # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 29 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 30dla $5, 0x40000001 # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 31 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 32dla $5, 0x80000001 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 33 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 34dla $5, 0x00010002 # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 35 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 36dla $5, 0x00020002 # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 37 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 38dla $5, 0x40000002 # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 39 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 40dla $5, 0x80000002 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 41 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 42dla $5, 0x00014000 # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 43 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 44dla $5, 0x00024000 # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 45 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 46dla $5, 0x40004000 # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 47 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 48dla $5, 0x80004000 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 49 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 50dla $5, 0x00018000 # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 51 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 52dla $5, 0x00028000 # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 53 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 54dla $5, 0x40008000 # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 55 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 56dla $5, 0x80008000 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 57 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 58dla $5, 0xffff4000 # CHECK: lui $5, 65535 # encoding: [0x3c,0x05,0xff,0xff] 59 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 60dla $5, 0xfffe8000 # CHECK: lui $5, 65534 # encoding: [0x3c,0x05,0xff,0xfe] 61 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 62dla $5, 0xc0008000 # CHECK: lui $5, 49152 # encoding: [0x3c,0x05,0xc0,0x00] 63 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 64dla $5, 0x80008000 # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 65 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 66 67dla $5, 0x00000001($6) # CHECK: addiu $5, $6, 1 # encoding: [0x24,0xc5,0x00,0x01] 68dla $5, 0x00000002($6) # CHECK: addiu $5, $6, 2 # encoding: [0x24,0xc5,0x00,0x02] 69dla $5, 0x00004000($6) # CHECK: addiu $5, $6, 16384 # encoding: [0x24,0xc5,0x40,0x00] 70dla $5, 0x00008000($6) # CHECK: ori $5, $zero, 32768 # encoding: [0x34,0x05,0x80,0x00] 71 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 72dla $5, 0xffffffff($6) # CHECK: addiu $5, $6, -1 # encoding: [0x24,0xc5,0xff,0xff] 73dla $5, 0xfffffffe($6) # CHECK: addiu $5, $6, -2 # encoding: [0x24,0xc5,0xff,0xfe] 74dla $5, 0xffffc000($6) # CHECK: addiu $5, $6, -16384 # encoding: [0x24,0xc5,0xc0,0x00] 75dla $5, 0xffff8000($6) # CHECK: addiu $5, $6, -32768 # encoding: [0x24,0xc5,0x80,0x00] 76 77dla $5, 0x00010000($6) # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 78 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 79dla $5, 0x00020000($6) # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 80 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 81dla $5, 0x40000000($6) # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 82 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 83dla $5, 0x80000000($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 84 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 85dla $5, 0xffff0000($6) # CHECK: lui $5, 65535 # encoding: [0x3c,0x05,0xff,0xff] 86 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 87dla $5, 0xfffe0000($6) # CHECK: lui $5, 65534 # encoding: [0x3c,0x05,0xff,0xfe] 88 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 89dla $5, 0xc0000000($6) # CHECK: lui $5, 49152 # encoding: [0x3c,0x05,0xc0,0x00] 90 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 91dla $5, 0x80000000($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 92 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 93 94dla $5, 0x00010001($6) # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 95 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 96 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 97dla $5, 0x00020001($6) # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 98 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 99 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 100dla $5, 0x40000001($6) # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 101 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 102 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 103dla $5, 0x80000001($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 104 # CHECK: ori $5, $5, 1 # encoding: [0x34,0xa5,0x00,0x01] 105 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 106dla $5, 0x00010002($6) # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 107 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 108 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 109dla $5, 0x00020002($6) # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 110 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 111 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 112dla $5, 0x40000002($6) # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 113 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 114 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 115dla $5, 0x80000002($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 116 # CHECK: ori $5, $5, 2 # encoding: [0x34,0xa5,0x00,0x02] 117 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 118dla $5, 0x00014000($6) # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 119 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 120 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 121dla $5, 0x00024000($6) # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 122 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 123 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 124dla $5, 0x40004000($6) # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 125 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 126 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 127dla $5, 0x80004000($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 128 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 129 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 130dla $5, 0x00018000($6) # CHECK: lui $5, 1 # encoding: [0x3c,0x05,0x00,0x01] 131 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 132 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 133dla $5, 0x00028000($6) # CHECK: lui $5, 2 # encoding: [0x3c,0x05,0x00,0x02] 134 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 135 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 136dla $5, 0x40008000($6) # CHECK: lui $5, 16384 # encoding: [0x3c,0x05,0x40,0x00] 137 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 138 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 139dla $5, 0x80008000($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 140 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 141 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 142dla $5, 0xffff4000($6) # CHECK: lui $5, 65535 # encoding: [0x3c,0x05,0xff,0xff] 143 # CHECK: ori $5, $5, 16384 # encoding: [0x34,0xa5,0x40,0x00] 144 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 145dla $5, 0xfffe8000($6) # CHECK: lui $5, 65534 # encoding: [0x3c,0x05,0xff,0xfe] 146 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 147 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 148dla $5, 0xc0008000($6) # CHECK: lui $5, 49152 # encoding: [0x3c,0x05,0xc0,0x00] 149 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 150 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 151dla $5, 0x80008000($6) # CHECK: lui $5, 32768 # encoding: [0x3c,0x05,0x80,0x00] 152 # CHECK: ori $5, $5, 32768 # encoding: [0x34,0xa5,0x80,0x00] 153 # CHECK: addu $5, $5, $6 # encoding: [0x00,0xa6,0x28,0x21] 154# There are no further interesting immediates. 155 156symbol: # CHECK-LABEL: symbol: 157.extern extern_sym 158.option pic0 # CHECK-LABEL: .option pic0 159dla $5, extern_sym 160 161# CHECK: lui $5, %hi(extern_sym) # encoding: [0x3c,0x05,A,A] 162# CHECK: # fixup A - offset: 0, value: %hi(extern_sym), kind: fixup_Mips_HI16 163# CHECK: addiu $5, $5, %lo(extern_sym) # encoding: [0x24,0xa5,A,A] 164# CHECK: # fixup A - offset: 0, value: %lo(extern_sym), kind: fixup_Mips_LO16 165 166dla $5, extern_sym($8) 167 168# CHECK: lui $5, %hi(extern_sym) # encoding: [0x3c,0x05,A,A] 169# CHECK: # fixup A - offset: 0, value: %hi(extern_sym), kind: fixup_Mips_HI16 170# CHECK: addiu $5, $5, %lo(extern_sym) # encoding: [0x24,0xa5,A,A] 171# CHECK: # fixup A - offset: 0, value: %lo(extern_sym), kind: fixup_Mips_LO16 172# CHECK: addu $5, $5, $8 # encoding: [0x00,0xa8,0x28,0x21] 173 174dla $5, extern_sym($5) 175 176# CHECK: lui $1, %hi(extern_sym) # encoding: [0x3c,0x01,A,A] 177# CHECK: # fixup A - offset: 0, value: %hi(extern_sym), kind: fixup_Mips_HI16 178# CHECK: addiu $1, $1, %lo(extern_sym) # encoding: [0x24,0x21,A,A] 179# CHECK: # fixup A - offset: 0, value: %lo(extern_sym), kind: fixup_Mips_LO16 180# CHECK: addu $5, $1, $5 # encoding: [0x00,0x25,0x28,0x21] 181 182dla $5, extern_sym+8 183 184# CHECK: lui $5, %hi(extern_sym+8) # encoding: [0x3c,0x05,A,A] 185# CHECK: # fixup A - offset: 0, value: %hi(extern_sym+8), kind: fixup_Mips_HI16 186# CHECK: addiu $5, $5, %lo(extern_sym+8) # encoding: [0x24,0xa5,A,A] 187# CHECK: # fixup A - offset: 0, value: %lo(extern_sym+8), kind: fixup_Mips_LO16 188 189dla $5, extern_sym+8($8) 190 191# CHECK: lui $5, %hi(extern_sym+8) # encoding: [0x3c,0x05,A,A] 192# CHECK: # fixup A - offset: 0, value: %hi(extern_sym+8), kind: fixup_Mips_HI16 193# CHECK: addiu $5, $5, %lo(extern_sym+8) # encoding: [0x24,0xa5,A,A] 194# CHECK: # fixup A - offset: 0, value: %lo(extern_sym+8), kind: fixup_Mips_LO16 195# CHECK: addu $5, $5, $8 # encoding: [0x00,0xa8,0x28,0x21] 196 197dla $5, extern_sym-8($5) 198 199# CHECK: lui $1, %hi(extern_sym-8) # encoding: [0x3c,0x01,A,A] 200# CHECK: # fixup A - offset: 0, value: %hi(extern_sym-8), kind: fixup_Mips_HI16 201# CHECK: addiu $1, $1, %lo(extern_sym-8) # encoding: [0x24,0x21,A,A] 202# CHECK: # fixup A - offset: 0, value: %lo(extern_sym-8), kind: fixup_Mips_LO16 203# CHECK: addu $5, $1, $5 # encoding: [0x00,0x25,0x28,0x21] 204 205dla $5, extern_sym-8 206 207# CHECK: lui $5, %hi(extern_sym-8) # encoding: [0x3c,0x05,A,A] 208# CHECK: # fixup A - offset: 0, value: %hi(extern_sym-8), kind: fixup_Mips_HI16 209# CHECK: addiu $5, $5, %lo(extern_sym-8) # encoding: [0x24,0xa5,A,A] 210# CHECK: # fixup A - offset: 0, value: %lo(extern_sym-8), kind: fixup_Mips_LO16 211 212dla $5, extern_sym-8($8) 213 214# CHECK: lui $5, %hi(extern_sym-8) # encoding: [0x3c,0x05,A,A] 215# CHECK: # fixup A - offset: 0, value: %hi(extern_sym-8), kind: fixup_Mips_HI16 216# CHECK: addiu $5, $5, %lo(extern_sym-8) # encoding: [0x24,0xa5,A,A] 217# CHECK: # fixup A - offset: 0, value: %lo(extern_sym-8), kind: fixup_Mips_LO16 218# CHECK: addu $5, $5, $8 # encoding: [0x00,0xa8,0x28,0x21] 219 220dla $5, extern_sym-8($5) 221 222# CHECK: lui $1, %hi(extern_sym-8) # encoding: [0x3c,0x01,A,A] 223# CHECK: # fixup A - offset: 0, value: %hi(extern_sym-8), kind: fixup_Mips_HI16 224# CHECK: addiu $1, $1, %lo(extern_sym-8) # encoding: [0x24,0x21,A,A] 225# CHECK: # fixup A - offset: 0, value: %lo(extern_sym-8), kind: fixup_Mips_LO16 226# CHECK: addu $5, $1, $5 # encoding: [0x00,0x25,0x28,0x21] 227 228.option pic2 229