2015-01-27 01:33:46 +08:00
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown -target-abi o32 -filetype=obj -o - %s | \
|
2014-05-01 18:24:46 +08:00
|
|
|
# RUN: llvm-objdump -d -r -arch=mips64 - | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=O32 %s
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-01-27 01:33:46 +08:00
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown -target-abi o32 %s | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=ASM %s
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-01-27 01:33:46 +08:00
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown -target-abi n32 -filetype=obj -o - %s | \
|
2015-02-18 21:46:53 +08:00
|
|
|
# RUN: llvm-objdump -d -r -t -arch=mips64 - | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=NXX -check-prefix=N32 %s
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-01-27 01:33:46 +08:00
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown -target-abi n32 %s | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=ASM %s
|
2014-03-27 21:52:53 +08:00
|
|
|
|
2014-05-01 18:24:46 +08:00
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown %s -filetype=obj -o - | \
|
2015-02-18 21:46:53 +08:00
|
|
|
# RUN: llvm-objdump -d -r -t -arch=mips64 - | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=NXX -check-prefix=N64 %s
|
2014-05-01 18:24:46 +08:00
|
|
|
|
|
|
|
# RUN: llvm-mc -triple mips64-unknown-unknown %s | \
|
2015-09-21 17:26:55 +08:00
|
|
|
# RUN: FileCheck -check-prefix=ALL -check-prefix=ASM %s
|
2014-03-27 21:52:53 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.option pic2
|
|
|
|
t1:
|
|
|
|
.cpsetup $25, 8, __cerror
|
2015-09-21 17:26:55 +08:00
|
|
|
nop
|
2015-09-22 18:50:09 +08:00
|
|
|
.cpreturn
|
|
|
|
nop
|
2014-03-27 21:52:53 +08:00
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ALL-LABEL: t1:
|
2014-03-27 21:52:53 +08:00
|
|
|
|
|
|
|
# O32-NOT: __cerror
|
|
|
|
|
2014-05-01 18:24:46 +08:00
|
|
|
# FIXME: Direct object emission for N32 is still under development.
|
|
|
|
# N32 doesn't allow 3 operations to be specified in the same relocation
|
|
|
|
# record like N64 does.
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# NXX-NEXT: sd $gp, 8($sp)
|
|
|
|
# NXX-NEXT: lui $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 __cerror
|
|
|
|
# NXX-NEXT: addiu $gp, $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 __cerror
|
|
|
|
# N32-NEXT: addu $gp, $gp, $25
|
|
|
|
# N64-NEXT: daddu $gp, $gp, $25
|
2014-03-27 21:52:53 +08:00
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ASM-NEXT: .cpsetup $25, 8, __cerror
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ALL-NEXT: nop
|
2014-03-27 21:52:53 +08:00
|
|
|
|
2015-09-22 18:50:09 +08:00
|
|
|
# ASM-NEXT: .cpreturn
|
|
|
|
# NXX-NEXT: ld $gp, 8($sp)
|
|
|
|
|
|
|
|
# ALL-NEXT: nop
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
t2:
|
2014-03-27 21:52:53 +08:00
|
|
|
.cpsetup $25, $2, __cerror
|
2015-09-21 17:26:55 +08:00
|
|
|
nop
|
2015-09-22 18:50:09 +08:00
|
|
|
.cpreturn
|
|
|
|
nop
|
2015-09-21 17:26:55 +08:00
|
|
|
|
|
|
|
# ALL-LABEL: t2:
|
2014-03-27 21:52:53 +08:00
|
|
|
|
|
|
|
# O32-NOT: __cerror
|
|
|
|
|
2014-05-01 18:24:46 +08:00
|
|
|
# FIXME: Direct object emission for N32 is still under development.
|
|
|
|
# N32 doesn't allow 3 operations to be specified in the same relocation
|
|
|
|
# record like N64 does.
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# NXX-NEXT: move $2, $gp
|
|
|
|
# NXX-NEXT: lui $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 __cerror
|
|
|
|
# NXX-NEXT: addiu $gp, $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 __cerror
|
|
|
|
# N32-NEXT: addu $gp, $gp, $25
|
|
|
|
# N64-NEXT: daddu $gp, $gp, $25
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ASM-NEXT: .cpsetup $25, $2, __cerror
|
|
|
|
|
|
|
|
# ALL-NEXT: nop
|
2014-05-01 18:24:46 +08:00
|
|
|
|
2015-09-22 18:50:09 +08:00
|
|
|
# ASM-NEXT: .cpreturn
|
|
|
|
# NXX-NEXT: move $gp, $2
|
|
|
|
|
|
|
|
# ALL-NEXT: nop
|
|
|
|
|
2015-02-18 21:46:53 +08:00
|
|
|
# .cpsetup with local labels (PR22518):
|
2015-09-21 17:26:55 +08:00
|
|
|
|
|
|
|
# The '1:' label isn't emitted in all cases but we still want a label to match
|
|
|
|
# so we force one here.
|
|
|
|
|
|
|
|
t3:
|
|
|
|
nop
|
2015-02-18 21:46:53 +08:00
|
|
|
1:
|
|
|
|
.cpsetup $25, $2, 1b
|
|
|
|
nop
|
|
|
|
sub $3, $3, $2
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ALL-LABEL: t3:
|
|
|
|
# ALL-NEXT: nop
|
|
|
|
|
|
|
|
# O32-NEXT: nop
|
|
|
|
# O32-NEXT: sub $3, $3, $2
|
2015-02-18 21:46:53 +08:00
|
|
|
|
|
|
|
# FIXME: Direct object emission for N32 is still under development.
|
|
|
|
# N32 doesn't allow 3 operations to be specified in the same relocation
|
|
|
|
# record like N64 does.
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# NXX: $tmp0:
|
|
|
|
# NXX-NEXT: move $2, $gp
|
|
|
|
# NXX-NEXT: lui $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 $tmp0
|
|
|
|
# NXX-NEXT: addiu $gp, $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 $tmp0
|
|
|
|
# N32-NEXT: addu $gp, $gp, $25
|
|
|
|
# N64-NEXT: daddu $gp, $gp, $25
|
|
|
|
# NXX-NEXT: nop
|
|
|
|
# NXX-NEXT: sub $3, $3, $2
|
|
|
|
|
|
|
|
# ASM: $tmp0:
|
|
|
|
# ASM-NEXT: .cpsetup $25, $2, $tmp0
|
2015-02-18 21:46:53 +08:00
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# Ensure we have at least one instruction between labels so that the labels
|
|
|
|
# we're matching aren't removed.
|
|
|
|
nop
|
|
|
|
# ALL-NEXT: nop
|
2015-02-18 21:46:53 +08:00
|
|
|
|
2014-05-01 18:24:46 +08:00
|
|
|
.option pic0
|
2015-09-21 17:26:55 +08:00
|
|
|
t4:
|
2014-05-01 18:24:46 +08:00
|
|
|
nop
|
|
|
|
.cpsetup $25, 8, __cerror
|
|
|
|
nop
|
2015-09-22 18:50:09 +08:00
|
|
|
.cpreturn
|
|
|
|
nop
|
2014-05-01 18:24:46 +08:00
|
|
|
|
|
|
|
# Testing that .cpsetup expands to nothing in this case
|
|
|
|
# by checking that the next instruction after the first
|
|
|
|
# nop is also a 'nop'.
|
2015-09-21 17:26:55 +08:00
|
|
|
|
|
|
|
# ALL-LABEL: t4:
|
|
|
|
|
2015-09-22 18:50:09 +08:00
|
|
|
# NXX-NEXT: nop
|
2015-09-21 17:26:55 +08:00
|
|
|
# NXX-NEXT: nop
|
2014-05-01 18:24:46 +08:00
|
|
|
# NXX-NEXT: nop
|
|
|
|
|
2015-09-21 17:26:55 +08:00
|
|
|
# ASM-NEXT: nop
|
|
|
|
# ASM-NEXT: .cpsetup $25, 8, __cerror
|
|
|
|
# ASM-NEXT: nop
|
2015-09-22 18:50:09 +08:00
|
|
|
# ASM-NEXT: .cpreturn
|
|
|
|
# ASM-NEXT: nop
|
2015-09-21 17:26:55 +08:00
|
|
|
|
|
|
|
# Test that we accept constant expressions.
|
|
|
|
.option pic2
|
|
|
|
t5:
|
|
|
|
.cpsetup $25, ((8*4) - (3*8)), __cerror
|
|
|
|
nop
|
|
|
|
|
|
|
|
# ALL-LABEL: t5:
|
|
|
|
|
|
|
|
# O32-NOT: __cerror
|
|
|
|
|
|
|
|
# FIXME: Direct object emission for N32 is still under development.
|
|
|
|
# N32 doesn't allow 3 operations to be specified in the same relocation
|
|
|
|
# record like N64 does.
|
|
|
|
|
|
|
|
# NXX-NEXT: sd $gp, 8($sp)
|
|
|
|
# NXX-NEXT: lui $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 __cerror
|
|
|
|
# NXX-NEXT: addiu $gp, $gp, 0
|
|
|
|
# NXX-NEXT: R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 __cerror
|
|
|
|
# N32-NEXT: addu $gp, $gp, $25
|
|
|
|
# N64-NEXT: daddu $gp, $gp, $25
|
|
|
|
|
|
|
|
# ASM-NEXT: .cpsetup $25, 8, __cerror
|
|
|
|
|
|
|
|
# ALL-NEXT: nop
|
|
|
|
|
|
|
|
# NXX-LABEL: SYMBOL TABLE:
|
2015-02-18 21:46:53 +08:00
|
|
|
|
|
|
|
# For .cpsetup with local labels, we need to check if $tmp0 is in the symbol
|
|
|
|
# table:
|
2015-06-23 19:31:32 +08:00
|
|
|
# NXX: .text 00000000 $tmp0
|