1; RUN: llc -mtriple=aarch64-none-linux-gnu -verify-machineinstrs < %s | FileCheck %s
2
3; We used to not mark NZCV as being used in the continuation basic-block
4; when lowering a 128-bit "select" to branches. This meant a subsequent use
5; of the same flags gave an internal fault here.
6
7declare void @foo(fp128)
8
9define double @test_f128csel_flags(i32 %lhs, fp128 %a, fp128 %b) nounwind {
10; CHECK: test_f128csel_flags
11
12    %tst = icmp ne i32 %lhs, 42
13    %val = select i1 %tst, fp128 %a, fp128 %b
14; CHECK: cmp w0, #42
15; CHECK: b.eq .LBB0
16
17    call void @foo(fp128 %val)
18    %retval = select i1 %tst, double 4.0, double 5.0
19
20    ; It's also reasonably important that the actual fcsel comes before the
21    ; function call since bl may corrupt NZCV. We were doing the right thing anyway,
22    ; but just as well test it while we're here.
23; CHECK: fcsel {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}, ne
24; CHECK: bl foo
25
26    ret double %retval
27}
28