|
| 1 | +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
| 2 | + |
| 3 | +; RUN: llc -mtriple=riscv32 -mattr=+zfa,d -global-isel < %s \ |
| 4 | +; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64 |
| 5 | +; RUN: llc -mtriple=riscv64 -mattr=+zfa,d -global-isel < %s \ |
| 6 | +; RUN: | FileCheck %s --check-prefixes=CHECK-ZFA-f64 |
| 7 | +; RUN: llc -mtriple=riscv32 -mattr=+d -global-isel < %s \ |
| 8 | +; RUN: | FileCheck %s --check-prefix=CHECK-ZFA-libcall |
| 9 | + |
| 10 | + |
| 11 | +define double @fceil(double %a) { |
| 12 | +; CHECK-ZFA-f64-LABEL: fceil: |
| 13 | +; CHECK-ZFA-f64: # %bb.0: |
| 14 | +; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rup |
| 15 | +; CHECK-ZFA-f64-NEXT: ret |
| 16 | +; |
| 17 | +; CHECK-ZFA-libcall-LABEL: fceil: |
| 18 | +; CHECK-ZFA-libcall: # %bb.0: |
| 19 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 20 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 21 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 22 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 23 | +; CHECK-ZFA-libcall-NEXT: call ceil |
| 24 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 25 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 26 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 27 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 28 | +; CHECK-ZFA-libcall-NEXT: ret |
| 29 | + %b = call double @llvm.ceil.f64(double %a) |
| 30 | + ret double %b |
| 31 | +} |
| 32 | + |
| 33 | +define double @ffloor(double %a) { |
| 34 | +; CHECK-ZFA-f64-LABEL: ffloor: |
| 35 | +; CHECK-ZFA-f64: # %bb.0: |
| 36 | +; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rdn |
| 37 | +; CHECK-ZFA-f64-NEXT: ret |
| 38 | +; |
| 39 | +; CHECK-ZFA-libcall-LABEL: ffloor: |
| 40 | +; CHECK-ZFA-libcall: # %bb.0: |
| 41 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 42 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 43 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 44 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 45 | +; CHECK-ZFA-libcall-NEXT: call floor |
| 46 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 47 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 48 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 49 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 50 | +; CHECK-ZFA-libcall-NEXT: ret |
| 51 | + %b = call double @llvm.floor.f64(double %a) |
| 52 | + ret double %b |
| 53 | +} |
| 54 | + |
| 55 | +define double @frint(double %a) { |
| 56 | +; CHECK-ZFA-f64-LABEL: frint: |
| 57 | +; CHECK-ZFA-f64: # %bb.0: |
| 58 | +; CHECK-ZFA-f64-NEXT: froundnx.d fa0, fa0 |
| 59 | +; CHECK-ZFA-f64-NEXT: ret |
| 60 | +; |
| 61 | +; CHECK-ZFA-libcall-LABEL: frint: |
| 62 | +; CHECK-ZFA-libcall: # %bb.0: |
| 63 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 64 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 65 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 66 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 67 | +; CHECK-ZFA-libcall-NEXT: call rint |
| 68 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 69 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 70 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 71 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 72 | +; CHECK-ZFA-libcall-NEXT: ret |
| 73 | + %b = call double @llvm.rint.f64(double %a) |
| 74 | + ret double %b |
| 75 | +} |
| 76 | + |
| 77 | +define double @fnearbyint(double %a) { |
| 78 | +; CHECK-ZFA-f64-LABEL: fnearbyint: |
| 79 | +; CHECK-ZFA-f64: # %bb.0: |
| 80 | +; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0 |
| 81 | +; CHECK-ZFA-f64-NEXT: ret |
| 82 | +; |
| 83 | +; CHECK-ZFA-libcall-LABEL: fnearbyint: |
| 84 | +; CHECK-ZFA-libcall: # %bb.0: |
| 85 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 86 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 87 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 88 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 89 | +; CHECK-ZFA-libcall-NEXT: call nearbyint |
| 90 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 91 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 92 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 93 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 94 | +; CHECK-ZFA-libcall-NEXT: ret |
| 95 | + %b = call double @llvm.nearbyint.f64(double %a) |
| 96 | + ret double %b |
| 97 | +} |
| 98 | + |
| 99 | +define double @fround(double %a) { |
| 100 | +; CHECK-ZFA-f64-LABEL: fround: |
| 101 | +; CHECK-ZFA-f64: # %bb.0: |
| 102 | +; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rmm |
| 103 | +; CHECK-ZFA-f64-NEXT: ret |
| 104 | +; |
| 105 | +; CHECK-ZFA-libcall-LABEL: fround: |
| 106 | +; CHECK-ZFA-libcall: # %bb.0: |
| 107 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 108 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 109 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 110 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 111 | +; CHECK-ZFA-libcall-NEXT: call round |
| 112 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 113 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 114 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 115 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 116 | +; CHECK-ZFA-libcall-NEXT: ret |
| 117 | + %b = call double @llvm.round.f64(double %a) |
| 118 | + ret double %b |
| 119 | +} |
| 120 | + |
| 121 | +define double @froundeven(double %a) { |
| 122 | +; CHECK-ZFA-f64-LABEL: froundeven: |
| 123 | +; CHECK-ZFA-f64: # %bb.0: |
| 124 | +; CHECK-ZFA-f64-NEXT: fround.d fa0, fa0, rne |
| 125 | +; CHECK-ZFA-f64-NEXT: ret |
| 126 | +; |
| 127 | +; CHECK-ZFA-libcall-LABEL: froundeven: |
| 128 | +; CHECK-ZFA-libcall: # %bb.0: |
| 129 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, -16 |
| 130 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 16 |
| 131 | +; CHECK-ZFA-libcall-NEXT: sw ra, 12(sp) # 4-byte Folded Spill |
| 132 | +; CHECK-ZFA-libcall-NEXT: .cfi_offset ra, -4 |
| 133 | +; CHECK-ZFA-libcall-NEXT: call roundeven |
| 134 | +; CHECK-ZFA-libcall-NEXT: lw ra, 12(sp) # 4-byte Folded Reload |
| 135 | +; CHECK-ZFA-libcall-NEXT: .cfi_restore ra |
| 136 | +; CHECK-ZFA-libcall-NEXT: addi sp, sp, 16 |
| 137 | +; CHECK-ZFA-libcall-NEXT: .cfi_def_cfa_offset 0 |
| 138 | +; CHECK-ZFA-libcall-NEXT: ret |
| 139 | + %b = call double @llvm.roundeven.f64(double %a) |
| 140 | + ret double %b |
| 141 | +} |
| 142 | + |
| 143 | +;; TODO recreate this test with LIB call |
| 144 | +;define double @fmaximum(double %a, double %b) { |
| 145 | +;; CHECK-ZFA-f64-LABEL: fmaximum: |
| 146 | +;; CHECK-ZFA-f64: # %bb.0: |
| 147 | +;; CHECK-ZFA-f64-NEXT: fmaxm.d fa0, fa0, fa1 |
| 148 | +;; CHECK-ZFA-f64-NEXT: ret |
| 149 | +; %c = call double @llvm.maximum.f64(double %a, double %b) |
| 150 | +; ret double %c |
| 151 | +;} |
| 152 | +; |
| 153 | +;define double @fminimum(double %a, double %b) { |
| 154 | +;; CHECK-ZFA-f64-LABEL: fminimum: |
| 155 | +;; CHECK-ZFA-f64: # %bb.0: |
| 156 | +;; CHECK-ZFA-f64-NEXT: fminm.d fa0, fa0, fa1 |
| 157 | +;; CHECK-ZFA-f64-NEXT: ret |
| 158 | +; %c = call double @llvm.minimum.f64(double %a, double %b) |
| 159 | +; ret double %c |
| 160 | +;} |
0 commit comments