brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · f948d65 Raw
226 lines · plain
1# RUN: llvm-mc -triple mips-unknown-linux -target-abi o32 -filetype=obj -o - %s | \2# RUN:   llvm-objdump --no-print-imm-hex -d -r -z - | FileCheck --check-prefixes=ALL,O32 %s3 4# RUN: llvm-mc -triple mips-unknown-linux -target-abi o32 %s | \5# RUN:   FileCheck -check-prefixes=ASM,ASM-O32 %s6 7# RUN: llvm-mc -triple mips64-unknown-linux -target-abi n32 -filetype=obj -o - %s | \8# RUN:   llvm-objdump --no-print-imm-hex -d -r -z - | \9# RUN:   FileCheck -check-prefixes=ALL,NXX,N32 %s10 11# RUN: llvm-mc -triple mips64-unknown-linux -target-abi n32 %s | \12# RUN:   FileCheck -check-prefixes=ASM,ASM-N32 %s13 14# RUN: llvm-mc -triple mips64-unknown-linux %s -filetype=obj -o - | \15# RUN:   llvm-objdump --no-print-imm-hex -d -r -z - | \16# RUN:   FileCheck -check-prefixes=ALL,NXX,N64 %s17 18# RUN: llvm-mc -triple mips64-unknown-linux %s | \19# RUN:   FileCheck -check-prefixes=ASM,ASM-N64 %s20 21        .text22        .option pic223t1:24        .cpsetup $25, 8, __cerror25        nop26        .cpreturn27        nop28 29# ALL-LABEL: <t1>:30# ASM-LABEL: t1:31 32# O32-NOT: __cerror33 34# NXX-NEXT: sd       $gp, 8($sp)35# NXX-NEXT: lui      $gp, 036# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror37# N32-NEXT: R_MIPS_GPREL16 __cerror38# N32-NEXT: R_MIPS_SUB39# N32-NEXT: R_MIPS_HI1640# NXX-NEXT: addiu    $gp, $gp, 041# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror42# N32-NEXT: R_MIPS_GPREL16 __cerror43# N32-NEXT: R_MIPS_SUB44# N32-NEXT: R_MIPS_LO1645# N32-NEXT: addu     $gp, $gp, $2546# N64-NEXT: daddu    $gp, $gp, $2547 48# ASM-NEXT: .cpsetup $25, 8, __cerror49 50# ALL-NEXT: nop51 52# ASM: .cpreturn53# NXX-NEXT: ld $gp, 8($sp)54 55# ALL-NEXT: nop56 57t2:58        .cpsetup $25, $2, __cerror59        nop60        .cpreturn61        nop62 63# ALL-LABEL: <t2>:64# ASM-LABEL: t2:65 66# O32-NOT: __cerror67 68# NXX-NEXT: move     $2, $gp69# NXX-NEXT: lui      $gp, 070# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror71# N32-NEXT: R_MIPS_GPREL16 __cerror72# N32-NEXT: R_MIPS_SUB73# N32-NEXT: R_MIPS_HI1674# NXX-NEXT: addiu    $gp, $gp, 075# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror76# N32-NEXT: R_MIPS_GPREL16 __cerror77# N32-NEXT: R_MIPS_SUB78# N32-NEXT: R_MIPS_LO1679# N32-NEXT: addu     $gp, $gp, $2580# N64-NEXT: daddu    $gp, $gp, $2581 82# ASM-NEXT: .cpsetup $25, $2, __cerror83 84# ALL-NEXT: nop85 86# ASM: .cpreturn87# NXX-NEXT: move $gp, $288 89# ALL-NEXT: nop90 91# .cpsetup with local labels (PR22518):92 93# The '1:' label isn't emitted in all cases but we still want a label to match94# so we force one here.95 96t3:97        nop981:99        .cpsetup $25, $2, 1b100        nop101        sub $3, $3, $2102 103# ALL-LABEL: <t3>:104# ASM-LABEL: t3:105# ALL-NEXT:  nop106 107# O32-NEXT:   nop108# O32-NEXT:   sub $3, $3, $2109 110# NXX-NEXT: move     $2, $gp111# NXX-NEXT: lui      $gp, 0112# N64-NEXT: {{^ *0+}}40: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 .text113# N32-NEXT: {{^ *0+}}40: R_MIPS_GPREL16 .text114# N32-NEXT: R_MIPS_SUB115# N32-NEXT: R_MIPS_HI16116# NXX-NEXT: addiu    $gp, $gp, 0117# N64-NEXT: {{^ *0+}}44: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 .text118# N32-NEXT: {{^ *0+}}44: R_MIPS_GPREL16 .text119# N32-NEXT: R_MIPS_SUB120# N32-NEXT: R_MIPS_LO16121# N32-NEXT: addu     $gp, $gp, $25122# N64-NEXT: daddu    $gp, $gp, $25123# NXX-NEXT: nop124# NXX-NEXT: sub $3, $3, $2125 126# ASM-O32: [[LABEL:\$tmp0]]:127# ASM-N32: [[LABEL:\.Ltmp0]]:128# ASM-N64: [[LABEL:\.Ltmp0]]:129# ASM-NEXT: .cpsetup $25, $2, [[LABEL]]130 131# Ensure we have at least one instruction between labels so that the labels132# we're matching aren't removed.133        nop134# ALL-NEXT: nop135 136        .option pic0137t4:138        nop139        .cpsetup $25, 8, __cerror140        nop141        .cpreturn142        nop143 144# Testing that .cpsetup expands to nothing in this case145# by checking that the next instruction after the first146# nop is also a 'nop'.147 148# ALL-LABEL: <t4>:149# ASM-LABEL: t4:150 151# NXX-NEXT: nop152# NXX-NEXT: nop153# NXX-NEXT: nop154 155# ASM-NEXT: nop156# ASM-NEXT: .cpsetup $25, 8, __cerror157# ASM-NEXT: nop158# ASM-NEXT: .cpreturn159# ASM-NEXT: nop160 161# Test that we accept constant expressions.162        .option pic2163t5:164        .cpsetup $25, ((8*4) - (3*8)), __cerror165        nop166 167# ALL-LABEL: <t5>:168# ASM-LABEL: t5:169 170# O32-NOT: __cerror171 172# NXX-NEXT: sd       $gp, 8($sp)173# NXX-NEXT: lui      $gp, 0174# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror175# N32-NEXT: R_MIPS_GPREL16 __cerror176# N32-NEXT: R_MIPS_SUB177# N32-NEXT: R_MIPS_HI16178# NXX-NEXT: addiu    $gp, $gp, 0179# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror180# N32-NEXT: R_MIPS_GPREL16 __cerror181# N32-NEXT: R_MIPS_SUB182# N32-NEXT: R_MIPS_LO16183# N32-NEXT: addu     $gp, $gp, $25184# N64-NEXT: daddu    $gp, $gp, $25185 186# ASM-NEXT: .cpsetup $25, 8, __cerror187 188# ALL-NEXT: nop189 190t1b:191IMM_8 = 8192        .cpsetup $25, IMM_8, __cerror193        nop194        .cpreturn195        nop196 197# ALL-LABEL: <t1b>:198# ASM-LABEL: t1b:199# ASM-NEXT: IMM_8 = 8200 201# O32-NOT: __cerror202 203# NXX-NEXT: sd       $gp, 8($sp)204# NXX-NEXT: lui      $gp, 0205# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16  __cerror206# N32-NEXT: R_MIPS_GPREL16 __cerror207# N32-NEXT: R_MIPS_SUB208# N32-NEXT: R_MIPS_HI16209# NXX-NEXT: addiu    $gp, $gp, 0210# N64-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16  __cerror211# N32-NEXT: R_MIPS_GPREL16 __cerror212# N32-NEXT: R_MIPS_SUB213# N32-NEXT: R_MIPS_LO16214# N32-NEXT: addu     $gp, $gp, $25215# N64-NEXT: daddu    $gp, $gp, $25216 217# ASM-NEXT: .cpsetup $25, 8, __cerror218 219# ALL-NEXT: nop220 221# ASM: .cpreturn222# NXX-NEXT: ld $gp, 8($sp)223 224# ALL-NEXT: nop225 226