1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu %s -o - | FileCheck --check-prefix=DAG %s
3 ; RUN: llc -mtriple=aarch64-none-linux-gnu -global-isel %s -o - | FileCheck --check-prefix=GIS %s
5 declare i32 @llvm.get.fpmode.i32()
6 declare void @llvm.set.fpmode.i32(i32 %fpmode)
7 declare void @llvm.reset.fpmode()
9 define i32 @func_get_fpmode() #0 {
10 ; DAG-LABEL: func_get_fpmode:
11 ; DAG: // %bb.0: // %entry
12 ; DAG-NEXT: mrs x0, FPCR
13 ; DAG-NEXT: // kill: def $w0 killed $w0 killed $x0
16 ; GIS-LABEL: func_get_fpmode:
17 ; GIS: // %bb.0: // %entry
18 ; GIS-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
19 ; GIS-NEXT: add x0, sp, #12
20 ; GIS-NEXT: bl fegetmode
21 ; GIS-NEXT: ldr w0, [sp, #12]
22 ; GIS-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
25 %fpmode = call i32 @llvm.get.fpmode.i32()
29 define void @func_set_fpmode(i32 %fpmode) #0 {
30 ; DAG-LABEL: func_set_fpmode:
31 ; DAG: // %bb.0: // %entry
32 ; DAG-NEXT: mov w8, w0
33 ; DAG-NEXT: msr FPCR, x8
36 ; GIS-LABEL: func_set_fpmode:
37 ; GIS: // %bb.0: // %entry
38 ; GIS-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
39 ; GIS-NEXT: str w0, [sp, #12]
40 ; GIS-NEXT: add x0, sp, #12
41 ; GIS-NEXT: bl fesetmode
42 ; GIS-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
45 call void @llvm.set.fpmode.i32(i32 %fpmode)
49 define void @func_reset_fpmode() #0 {
50 ; DAG-LABEL: func_reset_fpmode:
51 ; DAG: // %bb.0: // %entry
52 ; DAG-NEXT: mov x9, #-48904 // =0xffffffffffff40f8
53 ; DAG-NEXT: mrs x8, FPCR
54 ; DAG-NEXT: movk x9, #63488, lsl #16
55 ; DAG-NEXT: and x8, x8, x9
56 ; DAG-NEXT: msr FPCR, x8
59 ; GIS-LABEL: func_reset_fpmode:
60 ; GIS: // %bb.0: // %entry
61 ; GIS-NEXT: mov x0, #-1 // =0xffffffffffffffff
62 ; GIS-NEXT: b fesetmode
64 call void @llvm.reset.fpmode()
68 attributes #0 = { nounwind }