1 # RUN: llc -O0 -mtriple aarch64-apple-ios %s -global-isel -start-after regbankselect \
2 # RUN: -stop-before instruction-select -o - | FileCheck --check-prefix=CHECK --check-prefix=OPTNONE %s
3 # RUN: llc -mtriple aarch64-apple-ios %s -global-isel -start-after regbankselect \
4 # RUN: -stop-before instruction-select -o - | FileCheck --check-prefix=CHECK --check-prefix=OPT %s
6 # Check that we are only running the localizer at O0 and that it runs
7 # between the regbankselect pass and the instruction-select.
8 # Moreover, check that it does what we expect.
10 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
11 target triple = "aarch64-apple-ios"
13 define float @foo(float %arg, i1 %cond) {
14 br i1 %cond, label %true, label %false
22 end: ; preds = %false, %true
23 %val = phi float [ 1.000000e+00, %true ], [ 2.000000e+00, %false ]
24 %res = fadd float %arg, %val
30 # CHECK-LABEL: name: foo
35 tracksRegLiveness: true
38 # CHECK-NEXT: - { id: 0, class: fpr, preferred-register: '' }
39 # CHECK-NEXT: - { id: 1, class: gpr, preferred-register: '' }
40 # CHECK-NEXT: - { id: 2, class: fpr, preferred-register: '' }
41 # CHECK-NEXT: - { id: 3, class: fpr, preferred-register: '' }
42 # CHECK-NEXT: - { id: 4, class: fpr, preferred-register: '' }
43 # CHECK-NEXT: - { id: 5, class: fpr, preferred-register: '' }
44 # CHECK-NEXT: - { id: 6, class: gpr, preferred-register: '' }
45 # The localizer will create two new values to materialize the constants.
46 # OPTNONE-NEXT: - { id: 7, class: fpr, preferred-register: '' }
47 # OPTNONE-NEXT: - { id: 8, class: fpr, preferred-register: '' }
48 - { id: 0, class: fpr }
49 - { id: 1, class: gpr }
50 - { id: 2, class: fpr }
51 - { id: 3, class: fpr }
52 - { id: 4, class: fpr }
53 - { id: 5, class: fpr }
54 - { id: 6, class: gpr }
56 # First block remains untouched
58 # CHECK: %4:fpr(s32) = G_FCONSTANT float 1.000000e+00
59 # CHECK: %5:fpr(s32) = G_FCONSTANT float 2.000000e+00
61 # Second block will get the constant 1.0 when the localizer is enabled.
62 # CHECK: bb.1.{{[a-zA-Z0-9]+}}:
63 # OPT: [[FONE:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 1.000000e+00
64 # OPTNONE: [[FONE:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 1.000000e+00
67 # Thrid block will get the constant 2.0 when the localizer is enabled.
68 # CHECK: bb.2.{{[a-zA-Z0-9]+}}:
69 # OPT: [[FTWO:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 2.000000e+00
70 # OPTNONE: [[FTWO:%[0-9]+]]:fpr(s32) = G_FCONSTANT float 2.000000e+00
73 # OPTNONE: %2:fpr(s32) = PHI [[FONE]](s32), %bb.1, [[FTWO]](s32), %bb.2
74 # OPT: %2:fpr(s32) = PHI [[FONE]](s32), %bb.1, [[FTWO]](s32), %bb.2
75 # CHECK-NEXT: G_FADD %0, %2
83 %4(s32) = G_FCONSTANT float 1.000000e+00
84 %5(s32) = G_FCONSTANT float 2.000000e+00
85 G_BRCOND %1(s1), %bb.1
94 %2(s32) = PHI %4(s32), %bb.1, %5(s32), %bb.2
95 %3(s32) = G_FADD %0, %2
97 RET_ReallyLR implicit $s0