|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 |
| 2 | +; RUN: llc < %s -mtriple=riscv32 -global-isel -code-model=small \ |
| 3 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-SMALL |
| 4 | +; RUN: llc < %s -mtriple=riscv32 -global-isel -code-model=medium \ |
| 5 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-MEDIUM |
| 6 | +; RUN: llc < %s -mtriple=riscv32 -global-isel -relocation-model=pic \ |
| 7 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV32-PIC |
| 8 | +; RUN: llc < %s -mtriple=riscv64 -global-isel -code-model=small \ |
| 9 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-SMALL |
| 10 | +; RUN: llc < %s -mtriple=riscv64 -global-isel -code-model=medium \ |
| 11 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-MEDIUM |
| 12 | +; RUN: llc < %s -mtriple=riscv64 -global-isel -relocation-model=pic \ |
| 13 | +; RUN: -verify-machineinstrs | FileCheck %s --check-prefix=RV64-PIC |
| 14 | + |
| 15 | +define void @constpool_f32(ptr %p) { |
| 16 | +; RV32-SMALL-LABEL: constpool_f32: |
| 17 | +; RV32-SMALL: # %bb.0: |
| 18 | +; RV32-SMALL-NEXT: lui a1, %hi(.LCPI0_0) |
| 19 | +; RV32-SMALL-NEXT: lw a1, %lo(.LCPI0_0)(a1) |
| 20 | +; RV32-SMALL-NEXT: sw a1, 0(a0) |
| 21 | +; RV32-SMALL-NEXT: ret |
| 22 | +; |
| 23 | +; RV32-MEDIUM-LABEL: constpool_f32: |
| 24 | +; RV32-MEDIUM: # %bb.0: |
| 25 | +; RV32-MEDIUM-NEXT: .Lpcrel_hi0: |
| 26 | +; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI0_0) |
| 27 | +; RV32-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1) |
| 28 | +; RV32-MEDIUM-NEXT: sw a1, 0(a0) |
| 29 | +; RV32-MEDIUM-NEXT: ret |
| 30 | +; |
| 31 | +; RV32-PIC-LABEL: constpool_f32: |
| 32 | +; RV32-PIC: # %bb.0: |
| 33 | +; RV32-PIC-NEXT: .Lpcrel_hi0: |
| 34 | +; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI0_0) |
| 35 | +; RV32-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1) |
| 36 | +; RV32-PIC-NEXT: sw a1, 0(a0) |
| 37 | +; RV32-PIC-NEXT: ret |
| 38 | +; |
| 39 | +; RV64-SMALL-LABEL: constpool_f32: |
| 40 | +; RV64-SMALL: # %bb.0: |
| 41 | +; RV64-SMALL-NEXT: lui a1, %hi(.LCPI0_0) |
| 42 | +; RV64-SMALL-NEXT: lw a1, %lo(.LCPI0_0)(a1) |
| 43 | +; RV64-SMALL-NEXT: sw a1, 0(a0) |
| 44 | +; RV64-SMALL-NEXT: ret |
| 45 | +; |
| 46 | +; RV64-MEDIUM-LABEL: constpool_f32: |
| 47 | +; RV64-MEDIUM: # %bb.0: |
| 48 | +; RV64-MEDIUM-NEXT: .Lpcrel_hi0: |
| 49 | +; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI0_0) |
| 50 | +; RV64-MEDIUM-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1) |
| 51 | +; RV64-MEDIUM-NEXT: sw a1, 0(a0) |
| 52 | +; RV64-MEDIUM-NEXT: ret |
| 53 | +; |
| 54 | +; RV64-PIC-LABEL: constpool_f32: |
| 55 | +; RV64-PIC: # %bb.0: |
| 56 | +; RV64-PIC-NEXT: .Lpcrel_hi0: |
| 57 | +; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI0_0) |
| 58 | +; RV64-PIC-NEXT: lw a1, %pcrel_lo(.Lpcrel_hi0)(a1) |
| 59 | +; RV64-PIC-NEXT: sw a1, 0(a0) |
| 60 | +; RV64-PIC-NEXT: ret |
| 61 | + store float 1.0, ptr %p |
| 62 | + ret void |
| 63 | +} |
| 64 | + |
| 65 | +define void @constpool_f64(ptr %p) { |
| 66 | +; RV32-SMALL-LABEL: constpool_f64: |
| 67 | +; RV32-SMALL: # %bb.0: |
| 68 | +; RV32-SMALL-NEXT: lui a1, %hi(.LCPI1_0) |
| 69 | +; RV32-SMALL-NEXT: addi a1, a1, %lo(.LCPI1_0) |
| 70 | +; RV32-SMALL-NEXT: lw a2, 0(a1) |
| 71 | +; RV32-SMALL-NEXT: lw a1, 4(a1) |
| 72 | +; RV32-SMALL-NEXT: sw a2, 0(a0) |
| 73 | +; RV32-SMALL-NEXT: sw a1, 4(a0) |
| 74 | +; RV32-SMALL-NEXT: ret |
| 75 | +; |
| 76 | +; RV32-MEDIUM-LABEL: constpool_f64: |
| 77 | +; RV32-MEDIUM: # %bb.0: |
| 78 | +; RV32-MEDIUM-NEXT: .Lpcrel_hi1: |
| 79 | +; RV32-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI1_0) |
| 80 | +; RV32-MEDIUM-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi1) |
| 81 | +; RV32-MEDIUM-NEXT: lw a2, 0(a1) |
| 82 | +; RV32-MEDIUM-NEXT: lw a1, 4(a1) |
| 83 | +; RV32-MEDIUM-NEXT: sw a2, 0(a0) |
| 84 | +; RV32-MEDIUM-NEXT: sw a1, 4(a0) |
| 85 | +; RV32-MEDIUM-NEXT: ret |
| 86 | +; |
| 87 | +; RV32-PIC-LABEL: constpool_f64: |
| 88 | +; RV32-PIC: # %bb.0: |
| 89 | +; RV32-PIC-NEXT: .Lpcrel_hi1: |
| 90 | +; RV32-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI1_0) |
| 91 | +; RV32-PIC-NEXT: addi a1, a1, %pcrel_lo(.Lpcrel_hi1) |
| 92 | +; RV32-PIC-NEXT: lw a2, 0(a1) |
| 93 | +; RV32-PIC-NEXT: lw a1, 4(a1) |
| 94 | +; RV32-PIC-NEXT: sw a2, 0(a0) |
| 95 | +; RV32-PIC-NEXT: sw a1, 4(a0) |
| 96 | +; RV32-PIC-NEXT: ret |
| 97 | +; |
| 98 | +; RV64-SMALL-LABEL: constpool_f64: |
| 99 | +; RV64-SMALL: # %bb.0: |
| 100 | +; RV64-SMALL-NEXT: lui a1, %hi(.LCPI1_0) |
| 101 | +; RV64-SMALL-NEXT: ld a1, %lo(.LCPI1_0)(a1) |
| 102 | +; RV64-SMALL-NEXT: sd a1, 0(a0) |
| 103 | +; RV64-SMALL-NEXT: ret |
| 104 | +; |
| 105 | +; RV64-MEDIUM-LABEL: constpool_f64: |
| 106 | +; RV64-MEDIUM: # %bb.0: |
| 107 | +; RV64-MEDIUM-NEXT: .Lpcrel_hi1: |
| 108 | +; RV64-MEDIUM-NEXT: auipc a1, %pcrel_hi(.LCPI1_0) |
| 109 | +; RV64-MEDIUM-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1) |
| 110 | +; RV64-MEDIUM-NEXT: sd a1, 0(a0) |
| 111 | +; RV64-MEDIUM-NEXT: ret |
| 112 | +; |
| 113 | +; RV64-PIC-LABEL: constpool_f64: |
| 114 | +; RV64-PIC: # %bb.0: |
| 115 | +; RV64-PIC-NEXT: .Lpcrel_hi1: |
| 116 | +; RV64-PIC-NEXT: auipc a1, %pcrel_hi(.LCPI1_0) |
| 117 | +; RV64-PIC-NEXT: ld a1, %pcrel_lo(.Lpcrel_hi1)(a1) |
| 118 | +; RV64-PIC-NEXT: sd a1, 0(a0) |
| 119 | +; RV64-PIC-NEXT: ret |
| 120 | + store double 1.0, ptr %p |
| 121 | + ret void |
| 122 | +} |
0 commit comments