• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=arm64-eabi -verify-machineinstrs | 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, double %l, double %r) 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 %l, double %r
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