Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 1 | # RUN: llvm-mc %s -triple=mips-unknown-linux -show-encoding -mcpu=mips32r6 \ |
| 2 | # RUN: | FileCheck %s -check-prefix=CHECK-FIXUP |
| 3 | # RUN: llvm-mc %s -filetype=obj -triple=mips-unknown-linux -mcpu=mips32r6 \ |
Elvina Yakubova | b36a3e6 | 2020-07-20 08:39:14 +0100 | [diff] [blame] | 4 | # RUN: | llvm-readobj -r - | FileCheck %s -check-prefix=CHECK-ELF |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 5 | #------------------------------------------------------------------------------ |
| 6 | # Check that the assembler can handle the documented syntax for fixups. |
| 7 | #------------------------------------------------------------------------------ |
Petar Jovanovic | d4f3723 | 2017-09-11 18:34:04 +0000 | [diff] [blame] | 8 | # CHECK-FIXUP: lapc $2, bar # encoding: [0xec,0b01000AAA,A,A] |
Zoran Jovanovic | b9c07f3 | 2014-06-12 12:40:00 +0000 | [diff] [blame] | 9 | # CHECK-FIXUP: # fixup A - offset: 0, |
| 10 | # CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 11 | # CHECK-FIXUP: beqc $5, $6, bar # encoding: [0x20,0xa6,A,A] |
| 12 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 13 | # CHECK-FIXUP: value: bar-4, kind: fixup_Mips_PC16 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 14 | # CHECK-FIXUP: bnec $5, $6, bar # encoding: [0x60,0xa6,A,A] |
| 15 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 16 | # CHECK-FIXUP: value: bar-4, kind: fixup_Mips_PC16 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 17 | # CHECK-FIXUP: beqzc $9, bar # encoding: [0xd9,0b001AAAAA,A,A] |
| 18 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 19 | # CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC21_S2 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 20 | # CHECK-FIXUP: bnezc $9, bar # encoding: [0xf9,0b001AAAAA,A,A] |
| 21 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 22 | # CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC21_S2 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 23 | # CHECK-FIXUP: balc bar # encoding: [0b111010AA,A,A,A] |
| 24 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 25 | # CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC26_S2 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 26 | # CHECK-FIXUP: bc bar # encoding: [0b110010AA,A,A,A] |
| 27 | # CHECK-FIXUP: # fixup A - offset: 0, |
Petar Jovanovic | b7915a1 | 2015-06-23 13:54:42 +0000 | [diff] [blame] | 28 | # CHECK-FIXUP: value: bar-4, kind: fixup_MIPS_PC26_S2 |
Zoran Jovanovic | b355e8f | 2014-05-27 14:58:51 +0000 | [diff] [blame] | 29 | # CHECK-FIXUP: aluipc $2, %pcrel_hi(bar) # encoding: [0xec,0x5f,A,A] |
| 30 | # CHECK-FIXUP: # fixup A - offset: 0, |
Daniel Sanders | fe98b2f | 2016-05-03 13:35:44 +0000 | [diff] [blame] | 31 | # CHECK-FIXUP: value: %pcrel_hi(bar), |
Zoran Jovanovic | b355e8f | 2014-05-27 14:58:51 +0000 | [diff] [blame] | 32 | # CHECK-FIXUP: kind: fixup_MIPS_PCHI16 |
| 33 | # CHECK-FIXUP: addiu $2, $2, %pcrel_lo(bar) # encoding: [0x24,0x42,A,A] |
| 34 | # CHECK-FIXUP: # fixup A - offset: 0, |
Daniel Sanders | fe98b2f | 2016-05-03 13:35:44 +0000 | [diff] [blame] | 35 | # CHECK-FIXUP: value: %pcrel_lo(bar), |
Zoran Jovanovic | b355e8f | 2014-05-27 14:58:51 +0000 | [diff] [blame] | 36 | # CHECK-FIXUP: kind: fixup_MIPS_PCLO16 |
Petar Jovanovic | d4f3723 | 2017-09-11 18:34:04 +0000 | [diff] [blame] | 37 | # CHECK-FIXUP: lapc $2, bar # encoding: [0xec,0b01000AAA,A,A] |
| 38 | # CHECK-FIXUP: # fixup A - offset: 0, |
| 39 | # CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2 |
Zoran Jovanovic | b9c07f3 | 2014-06-12 12:40:00 +0000 | [diff] [blame] | 40 | # CHECK-FIXUP: lwpc $2, bar # encoding: [0xec,0b01001AAA,A,A] |
| 41 | # CHECK-FIXUP: # fixup A - offset: 0, |
| 42 | # CHECK-FIXUP: value: bar, kind: fixup_MIPS_PC19_S2 |
Simon Atanasyan | f6551dd | 2019-10-03 12:08:26 +0000 | [diff] [blame] | 43 | # CHECK-FIXUP: jialc $5, bar # encoding: [0xf8,0x05,A,A] |
| 44 | # CHECK-FIXUP: # fixup A - offset: 0, |
| 45 | # CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16 |
| 46 | # CHECK-FIXUP: jic $5, bar # encoding: [0xd8,0x05,A,A] |
| 47 | # CHECK-FIXUP: # fixup A - offset: 0, |
| 48 | # CHECK-FIXUP: value: bar, kind: fixup_Mips_LO16 |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 49 | #------------------------------------------------------------------------------ |
| 50 | # Check that the appropriate relocations were created. |
| 51 | #------------------------------------------------------------------------------ |
| 52 | # CHECK-ELF: Relocations [ |
Georgii Rymar | 98a4289 | 2020-12-10 16:12:26 +0300 | [diff] [blame] | 53 | # CHECK-ELF: 0x0 R_MIPS_PC19_S2 bar |
| 54 | # CHECK-ELF: 0x4 R_MIPS_PC16 bar |
yingopq | e2182a6 | 2024-02-24 15:13:43 +0800 | [diff] [blame^] | 55 | # CHECK-ELF: 0xC R_MIPS_PC16 bar |
| 56 | # CHECK-ELF: 0x14 R_MIPS_PC21_S2 bar |
| 57 | # CHECK-ELF: 0x1C R_MIPS_PC21_S2 bar |
| 58 | # CHECK-ELF: 0x24 R_MIPS_PC26_S2 bar |
| 59 | # CHECK-ELF: 0x28 R_MIPS_PC26_S2 bar |
| 60 | # CHECK-ELF: 0x2C R_MIPS_PCHI16 bar |
| 61 | # CHECK-ELF: 0x30 R_MIPS_PCLO16 bar |
| 62 | # CHECK-ELF: 0x34 R_MIPS_PC19_S2 bar |
| 63 | # CHECK-ELF: 0x38 R_MIPS_PC19_S2 bar |
| 64 | # CHECK-ELF: 0x3C R_MIPS_LO16 bar |
| 65 | # CHECK-ELF: 0x40 R_MIPS_LO16 bar |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 66 | # CHECK-ELF: ] |
| 67 | |
Zoran Jovanovic | b9c07f3 | 2014-06-12 12:40:00 +0000 | [diff] [blame] | 68 | addiupc $2,bar |
Zoran Jovanovic | 10e06da | 2014-05-27 12:55:40 +0000 | [diff] [blame] | 69 | beqc $5, $6, bar |
| 70 | bnec $5, $6, bar |
| 71 | beqzc $9, bar |
| 72 | bnezc $9, bar |
| 73 | balc bar |
| 74 | bc bar |
Zoran Jovanovic | b355e8f | 2014-05-27 14:58:51 +0000 | [diff] [blame] | 75 | aluipc $2, %pcrel_hi(bar) |
| 76 | addiu $2, $2, %pcrel_lo(bar) |
Petar Jovanovic | d4f3723 | 2017-09-11 18:34:04 +0000 | [diff] [blame] | 77 | lapc $2,bar |
Zoran Jovanovic | b9c07f3 | 2014-06-12 12:40:00 +0000 | [diff] [blame] | 78 | lwpc $2,bar |
Simon Atanasyan | f6551dd | 2019-10-03 12:08:26 +0000 | [diff] [blame] | 79 | jialc $5, bar |
| 80 | jic $5, bar |