File: directcond.ll

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8~deb9u3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (84 lines) | stat: -rw-r--r-- 2,086 bytes parent folder | download | duplicates (32)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
; RUN: llc -verify-machineinstrs -o - %s -mtriple=arm64-apple-ios7.0 -aarch64-enable-atomic-cfg-tidy=0 | FileCheck %s
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -mattr=-fp-armv8 -aarch64-enable-atomic-cfg-tidy=0 | FileCheck --check-prefix=CHECK-NOFP %s

define i32 @test_select_i32(i1 %bit, i32 %a, i32 %b) {
; CHECK-LABEL: test_select_i32:
  %val = select i1 %bit, i32 %a, i32 %b
; CHECK: tst w0, #0x1
; CHECK-NEXT: csel w0, w1, w2, ne

  ret i32 %val
}

define i64 @test_select_i64(i1 %bit, i64 %a, i64 %b) {
; CHECK-LABEL: test_select_i64:
  %val = select i1 %bit, i64 %a, i64 %b
; CHECK: tst w0, #0x1
; CHECK-NEXT: csel x0, x1, x2, ne

  ret i64 %val
}

define float @test_select_float(i1 %bit, float %a, float %b) {
; CHECK-LABEL: test_select_float:
  %val = select i1 %bit, float %a, float %b
; CHECK: tst w0, #0x1
; CHECK-NEXT: fcsel s0, s0, s1, ne
; CHECK-NOFP-NOT: fcsel
  ret float %val
}

define double @test_select_double(i1 %bit, double %a, double %b) {
; CHECK-LABEL: test_select_double:
  %val = select i1 %bit, double %a, double %b
; CHECK: tst w0, #0x1
; CHECK-NEXT: fcsel d0, d0, d1, ne
; CHECK-NOFP-NOT: fcsel

  ret double %val
}

define i32 @test_brcond(i1 %bit) {
; CHECK-LABEL: test_brcond:
  br i1 %bit, label %true, label %false
; CHECK: tbz {{w[0-9]+}}, #0, {{.?LBB}}

true:
  ret i32 0
false:
  ret i32 42
}

define i1 @test_setcc_float(float %lhs, float %rhs) {
; CHECK: test_setcc_float
  %val = fcmp oeq float %lhs, %rhs
; CHECK: fcmp s0, s1
; CHECK: cset w0, eq
; CHECK-NOFP-NOT: fcmp
  ret i1 %val
}

define i1 @test_setcc_double(double %lhs, double %rhs) {
; CHECK: test_setcc_double
  %val = fcmp oeq double %lhs, %rhs
; CHECK: fcmp d0, d1
; CHECK: cset w0, eq
; CHECK-NOFP-NOT: fcmp
  ret i1 %val
}

define i1 @test_setcc_i32(i32 %lhs, i32 %rhs) {
; CHECK: test_setcc_i32
  %val = icmp ugt i32 %lhs, %rhs
; CHECK: cmp w0, w1
; CHECK: cset w0, hi
  ret i1 %val
}

define i1 @test_setcc_i64(i64 %lhs, i64 %rhs) {
; CHECK: test_setcc_i64
  %val = icmp ne i64 %lhs, %rhs
; CHECK: cmp x0, x1
; CHECK: cset w0, ne
  ret i1 %val
}