Home | History | Annotate | Download | only in cconv
      1 ; RUN: llc -mtriple=mips-linux-gnu -relocation-model=static < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
      2 ; RUN: llc -mtriple=mipsel-linux-gnu -relocation-model=static < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
      3 
      4 ; RUN-TODO: llc -mtriple=mips64-linux-gnu -relocation-model=static -mattr=-n64,+o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
      5 ; RUN-TODO: llc -mtriple=mips64el-linux-gnu -relocation-model=static -mattr=-n64,+o32 < %s | FileCheck --check-prefix=ALL --check-prefix=O32 %s
      6 
      7 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s
      8 ; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -mattr=-n64,+n32 < %s | FileCheck --check-prefix=ALL --check-prefix=N32 %s
      9 
     10 ; RUN: llc -mtriple=mips64-linux-gnu -relocation-model=static -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=N64 %s
     11 ; RUN: llc -mtriple=mips64el-linux-gnu -relocation-model=static -mattr=-n64,+n64 < %s | FileCheck --check-prefix=ALL --check-prefix=N64 %s
     12 
     13 ; Test the integer returns for all ABI's and byte orders as specified by
     14 ; section 5 of MD00305 (MIPS ABIs Described).
     15 
     16 ; We only test Linux because other OS's use different relocations and I don't
     17 ; know if this is correct.
     18 
     19 @byte = global i8 zeroinitializer
     20 @word = global i32 zeroinitializer
     21 @dword = global i64 zeroinitializer
     22 @float = global float zeroinitializer
     23 @double = global double zeroinitializer
     24 
     25 define i8 @reti8() nounwind {
     26 entry:
     27         %0 = load volatile i8* @byte
     28         ret i8 %0
     29 }
     30 
     31 ; ALL-LABEL: reti8:
     32 ; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(byte)
     33 ; O32-DAG:           lbu $2, %lo(byte)([[R1]])
     34 ; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(byte)
     35 ; N32-DAG:           lbu $2, %lo(byte)([[R1]])
     36 ; N64-DAG:           ld  [[R1:\$[0-9]+]], %got_disp(byte)($1)
     37 ; N64-DAG:           lbu $2, 0([[R1]])
     38 
     39 define i32 @reti32() nounwind {
     40 entry:
     41         %0 = load volatile i32* @word
     42         ret i32 %0
     43 }
     44 
     45 ; ALL-LABEL: reti32:
     46 ; O32-DAG:           lui [[R1:\$[0-9]+]], %hi(word)
     47 ; O32-DAG:           lw $2, %lo(word)([[R1]])
     48 ; N32-DAG:           lui [[R1:\$[0-9]+]], %hi(word)
     49 ; N32-DAG:           lw $2, %lo(word)([[R1]])
     50 ; N64-DAG:           ld  [[R1:\$[0-9]+]], %got_disp(word)($1)
     51 ; N64-DAG:           lw $2, 0([[R1]])
     52 
     53 define i64 @reti64() nounwind {
     54 entry:
     55         %0 = load volatile i64* @dword
     56         ret i64 %0
     57 }
     58 
     59 ; ALL-LABEL: reti64:
     60 ; On O32, we must use v0 and v1 for the return value
     61 ; O32-DAG:           lw $2, %lo(dword)([[R1:\$[0-9]+]])
     62 ; O32-DAG:           addiu [[R2:\$[0-9]+]], [[R1]], %lo(dword)
     63 ; O32-DAG:           lw $3, 4([[R2]])
     64 ; N32-DAG:           ld $2, %lo(dword)([[R1:\$[0-9]+]])
     65 ; N64-DAG:           ld  [[R1:\$[0-9]+]], %got_disp(dword)([[R1:\$[0-9]+]])
     66 ; N64-DAG:           ld $2, 0([[R1]])
     67