1 ; RUN: llc < %s -march=mips -relocation-model=static | FileCheck %s -check-prefix=STATIC-O32 2 ; RUN: llc < %s -march=mips -relocation-model=pic | FileCheck %s -check-prefix=PIC-O32 3 ; RUN: llc < %s -march=mips64 -relocation-model=pic -mcpu=mips64 -mattr=n64 | FileCheck %s -check-prefix=PIC-N64 4 5 define i32 @main() nounwind readnone { 6 entry: 7 %x = alloca i32, align 4 ; <i32*> [#uses=2] 8 store volatile i32 2, i32* %x, align 4 9 %0 = load volatile i32* %x, align 4 ; <i32> [#uses=1] 10 ; STATIC-O32: lui $[[R0:[0-9]+]], %hi($JTI0_0) 11 ; STATIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0) 12 ; STATIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2 13 ; PIC-O32: lw $[[R0:[0-9]+]], %got($JTI0_0) 14 ; PIC-O32: addiu ${{[0-9]+}}, $[[R0]], %lo($JTI0_0) 15 ; PIC-O32: sll ${{[0-9]+}}, ${{[0-9]+}}, 2 16 ; PIC-O32: addu $[[R1:[0-9]+]], ${{[0-9]+}}, $gp 17 ; PIC-O32: jr $[[R1]] 18 ; PIC-N64: ld $[[R0:[0-9]+]], %got_page($JTI0_0) 19 ; PIC-N64: daddiu ${{[0-9]+}}, $[[R0]], %got_ofst($JTI0_0) 20 ; PIC-N64: dsll ${{[0-9]+}}, ${{[0-9]+}}, 3 21 ; PIC-N64: daddu $[[R1:[0-9]+]], ${{[0-9]+}}, $gp 22 ; PIC-N64: jr $[[R1]] 23 switch i32 %0, label %bb4 [ 24 i32 0, label %bb5 25 i32 1, label %bb1 26 i32 2, label %bb2 27 i32 3, label %bb3 28 ] 29 30 bb1: ; preds = %entry 31 ret i32 2 32 33 ; CHECK: STATIC-O32: $BB0_2 34 bb2: ; preds = %entry 35 ret i32 0 36 37 bb3: ; preds = %entry 38 ret i32 3 39 40 bb4: ; preds = %entry 41 ret i32 4 42 43 bb5: ; preds = %entry 44 ret i32 1 45 } 46 47 ; STATIC-O32: .align 2 48 ; STATIC-O32: $JTI0_0: 49 ; STATIC-O32: .4byte 50 ; STATIC-O32: .4byte 51 ; STATIC-O32: .4byte 52 ; STATIC-O32: .4byte 53 ; PIC-O32: .align 2 54 ; PIC-O32: $JTI0_0: 55 ; PIC-O32: .gpword 56 ; PIC-O32: .gpword 57 ; PIC-O32: .gpword 58 ; PIC-O32: .gpword 59 ; PIC-N64: .align 3 60 ; PIC-N64: $JTI0_0: 61 ; PIC-N64: .gpdword 62 ; PIC-N64: .gpdword 63 ; PIC-N64: .gpdword 64 ; PIC-N64: .gpdword 65 66