75 lines · plain
1; RUN: llc -mtriple=riscv32 --code-model=small \2; RUN: -stop-after riscv-prera-expand-pseudo %s -o %t.mir3; RUN: llc -mtriple=riscv32 -run-pass riscv-expand-pseudo %t.mir -o - | \4; RUN: FileCheck %s -check-prefix=RV32-SMALL5;6; RUN: llc -mtriple=riscv32 --code-model=medium --relocation-model=pic \7; RUN: -stop-after riscv-prera-expand-pseudo %s -o %t.mir8; RUN: llc -mtriple=riscv32 -run-pass riscv-expand-pseudo %t.mir -o - | \9; RUN: FileCheck %s -check-prefix=RV32-MED10 11; This tests the RISC-V-specific serialization and deserialization of12; `target-flags(...)`13 14@g_e = external global i3215@g_i = internal global i32 016@t_un = external thread_local global i3217@t_ld = external thread_local(localdynamic) global i3218@t_ie = external thread_local(initialexec) global i3219@t_le = external thread_local(localexec) global i3220 21declare i32 @callee(i32) nounwind22 23define i32 @caller(i32 %a) nounwind {24; RV32-SMALL-LABEL: name: caller25; RV32-SMALL: target-flags(riscv-hi) @g_e26; RV32-SMALL-NEXT: target-flags(riscv-lo) @g_e27; RV32-SMALL: target-flags(riscv-hi) @g_i28; RV32-SMALL-NEXT: target-flags(riscv-lo) @g_i29; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_un30; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi0>31; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_ld32; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1>33; RV32-SMALL: target-flags(riscv-tls-got-hi) @t_ie34; RV32-SMALL-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>35; RV32-SMALL: target-flags(riscv-tprel-hi) @t_le36; RV32-SMALL-NEXT: target-flags(riscv-tprel-add) @t_le37; RV32-SMALL-NEXT: target-flags(riscv-tprel-lo) @t_le38; RV32-SMALL: target-flags(riscv-call) @callee39;40; RV32-MED-LABEL: name: caller41; RV32-MED: target-flags(riscv-got-hi) @g_e42; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi0>43; RV32-MED: target-flags(riscv-pcrel-hi) @g_i44; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi1>45; RV32-MED: target-flags(riscv-tls-gd-hi) @t_un46; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>47; RV32-MED: target-flags(riscv-call) &__tls_get_addr48; RV32-MED: target-flags(riscv-tls-gd-hi) @t_ld49; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi3>50; RV32-MED: target-flags(riscv-call) &__tls_get_addr51; RV32-MED: target-flags(riscv-tls-got-hi) @t_ie52; RV32-MED-NEXT: target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi4>53; RV32-MED: target-flags(riscv-tprel-hi) @t_le54; RV32-MED-NEXT: target-flags(riscv-tprel-add) @t_le55; RV32-MED-NEXT: target-flags(riscv-tprel-lo) @t_le56; RV32-MED: target-flags(riscv-call) @callee57;58 %b = load i32, ptr @g_e59 %c = load i32, ptr @g_i60 %d = load i32, ptr @t_un61 %e = load i32, ptr @t_ld62 %f = load i32, ptr @t_ie63 %g = load i32, ptr @t_le64 %sum = bitcast i32 0 to i3265 %sum.a = add i32 %sum, %a66 %sum.b = add i32 %sum.a, %b67 %sum.c = add i32 %sum.b, %c68 %sum.d = add i32 %sum.c, %d69 %sum.e = add i32 %sum.d, %e70 %sum.f = add i32 %sum.e, %f71 %sum.g = add i32 %sum.f, %g72 %retval = call i32 @callee(i32 %sum.g)73 ret i32 %retval74}75