xref: /llvm-project/llvm/test/CodeGen/AArch64/remat-const-float-simd.ll (revision 7a605ab7bfbc681c34335684f45b7da32d495db1)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -mattr=+neon | FileCheck %s --check-prefixes=CHECK,CHECK-NEON
3; RUN: llc < %s -mtriple=aarch64-none-linux-gnu -verify-machineinstrs -mattr=-neon | FileCheck %s --check-prefixes=CHECK,CHECK-SCALAR
4
5; Check that big fp constants can be rematerialized with movi
6target triple = "aarch64-unknown-linux-gnu"
7
8; float foo(void) { return float(2147483648); }
9define float @foo() {
10; CHECK-LABEL: foo:
11; CHECK:       // %bb.0: // %entry
12; CHECK-NEON-NEXT:    movi v0.2s, #79, lsl #24
13; CHECK-SCALAR-NEXT:    mov w8, #1325400064
14; CHECK-SCALAR-NEXT:    fmov s0, w8
15; CHECK-NEXT:    ret
16entry:
17 ret float 0x41E0000000000000
18}
19
20; float foo2(float p) { return p + float(2147483648); }
21define float @foo2(float %f) {
22; CHECK-LABEL: foo2:
23; CHECK:       // %bb.0: // %entry
24; CHECK-NEON-NEXT:    movi v1.2s, #79, lsl #24
25; CHECK-NEON-NEXT:    fadd s0, s0, s1
26; CHECK-SCALAR-NEXT:    mov w8, #1325400064
27; CHECK-SCALAR-NEXT:    fmov s1, w8
28; CHECK-SCALAR-NEXT:    fadd s0, s0, s1
29; CHECK-NEXT:    ret
30entry:
31  %p = fadd float %f, 0x41E0000000000000
32  ret float %p
33}
34