|
1 | 1 | ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 |
2 | | -; RUN: llc < %s -fast-isel -fast-isel-abort=1 -verify-machineinstrs | FileCheck %s |
3 | | -; RUN: llc < %s -global-isel -global-isel-abort=1 -verify-machineinstrs | FileCheck %s --check-prefix=GISEL |
4 | | -; RUN: llc < %s -fast-isel=0 -global-isel=0 -verify-machineinstrs | FileCheck %s |
| 2 | +; RUN: llc < %s -mtriple=i686-linux-gnu -mattr=+cmov -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=X86 |
| 3 | +; RUN: llc < %s -mtriple=i686-linux-gnu -mattr=+cmov -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=X86-GISEL |
| 4 | +; RUN: llc < %s -mtriple=i686-linux-gnu -mattr=+cmov -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefix=X86 |
| 5 | +; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=X64 |
| 6 | +; RUN: llc < %s -mtriple=x86_64-linux-gnu -global-isel -global-isel-abort=1 | FileCheck %s --check-prefix=X64-GISEL |
| 7 | +; RUN: llc < %s -mtriple=x86_64-linux-gnu -fast-isel=0 -global-isel=0 | FileCheck %s --check-prefix=X64 |
| 8 | + |
5 | 9 |
|
6 | 10 | target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" |
7 | 11 | target triple = "x86_64-unknown-unknown" |
8 | 12 |
|
9 | 13 | ; Test that we can generate an fcmove, and also that it passes verification. |
10 | 14 |
|
11 | | -define x86_fp80 @cmove_f(x86_fp80 %a, x86_fp80 %b, i32 %c) { |
12 | | -; CHECK-LABEL: cmove_f: |
13 | | -; CHECK: # %bb.0: |
14 | | -; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) |
15 | | -; CHECK-NEXT: fldt {{[0-9]+}}(%rsp) |
16 | | -; CHECK-NEXT: testl %edi, %edi |
17 | | -; CHECK-NEXT: fadd %st(1), %st |
18 | | -; CHECK-NEXT: fxch %st(1) |
19 | | -; CHECK-NEXT: fcmove %st(1), %st |
20 | | -; CHECK-NEXT: fstp %st(1) |
21 | | -; CHECK-NEXT: retq |
22 | | -; |
23 | | -; GISEL-LABEL: cmove_f: |
24 | | -; GISEL: # %bb.0: |
25 | | -; GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
26 | | -; GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
27 | | -; GISEL-NEXT: xorl %eax, %eax |
28 | | -; GISEL-NEXT: cmpl $0, %edi |
29 | | -; GISEL-NEXT: sete %al |
30 | | -; GISEL-NEXT: fadd %st, %st(1) |
31 | | -; GISEL-NEXT: andl $1, %eax |
32 | | -; GISEL-NEXT: testl %eax, %eax |
33 | | -; GISEL-NEXT: fxch %st(1) |
34 | | -; GISEL-NEXT: fcmove %st(1), %st |
35 | | -; GISEL-NEXT: fstp %st(1) |
36 | | -; GISEL-NEXT: retq |
| 15 | +define x86_fp80 @cmove_cmp(x86_fp80 %a, x86_fp80 %b, i32 %c) { |
| 16 | +; X86-LABEL: cmove_cmp: |
| 17 | +; X86: # %bb.0: |
| 18 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 19 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 20 | +; X86-NEXT: cmpl $0, {{[0-9]+}}(%esp) |
| 21 | +; X86-NEXT: fadd %st(1), %st |
| 22 | +; X86-NEXT: fxch %st(1) |
| 23 | +; X86-NEXT: fcmove %st(1), %st |
| 24 | +; X86-NEXT: fstp %st(1) |
| 25 | +; X86-NEXT: retl |
| 26 | +; |
| 27 | +; X86-GISEL-LABEL: cmove_cmp: |
| 28 | +; X86-GISEL: # %bb.0: |
| 29 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 30 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 31 | +; X86-GISEL-NEXT: xorl %eax, %eax |
| 32 | +; X86-GISEL-NEXT: cmpl $0, {{[0-9]+}}(%esp) |
| 33 | +; X86-GISEL-NEXT: sete %al |
| 34 | +; X86-GISEL-NEXT: fadd %st, %st(1) |
| 35 | +; X86-GISEL-NEXT: andl $1, %eax |
| 36 | +; X86-GISEL-NEXT: testl %eax, %eax |
| 37 | +; X86-GISEL-NEXT: fxch %st(1) |
| 38 | +; X86-GISEL-NEXT: fcmove %st(1), %st |
| 39 | +; X86-GISEL-NEXT: fstp %st(1) |
| 40 | +; X86-GISEL-NEXT: retl |
| 41 | +; |
| 42 | +; X64-LABEL: cmove_cmp: |
| 43 | +; X64: # %bb.0: |
| 44 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 45 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 46 | +; X64-NEXT: testl %edi, %edi |
| 47 | +; X64-NEXT: fadd %st(1), %st |
| 48 | +; X64-NEXT: fxch %st(1) |
| 49 | +; X64-NEXT: fcmove %st(1), %st |
| 50 | +; X64-NEXT: fstp %st(1) |
| 51 | +; X64-NEXT: retq |
| 52 | +; |
| 53 | +; X64-GISEL-LABEL: cmove_cmp: |
| 54 | +; X64-GISEL: # %bb.0: |
| 55 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 56 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 57 | +; X64-GISEL-NEXT: xorl %eax, %eax |
| 58 | +; X64-GISEL-NEXT: cmpl $0, %edi |
| 59 | +; X64-GISEL-NEXT: sete %al |
| 60 | +; X64-GISEL-NEXT: fadd %st, %st(1) |
| 61 | +; X64-GISEL-NEXT: andl $1, %eax |
| 62 | +; X64-GISEL-NEXT: testl %eax, %eax |
| 63 | +; X64-GISEL-NEXT: fxch %st(1) |
| 64 | +; X64-GISEL-NEXT: fcmove %st(1), %st |
| 65 | +; X64-GISEL-NEXT: fstp %st(1) |
| 66 | +; X64-GISEL-NEXT: retq |
37 | 67 | %test = icmp eq i32 %c, 0 |
38 | 68 | %add = fadd x86_fp80 %a, %b |
39 | 69 | %ret = select i1 %test, x86_fp80 %add, x86_fp80 %b |
40 | 70 | ret x86_fp80 %ret |
41 | 71 | } |
| 72 | + |
| 73 | +define x86_fp80 @cmove_arg(x86_fp80 %a, x86_fp80 %b, i1 %test) { |
| 74 | +; X86-LABEL: cmove_arg: |
| 75 | +; X86: # %bb.0: |
| 76 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 77 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 78 | +; X86-NEXT: fadd %st(1), %st |
| 79 | +; X86-NEXT: testb $1, {{[0-9]+}}(%esp) |
| 80 | +; X86-NEXT: fxch %st(1) |
| 81 | +; X86-NEXT: fcmovne %st(1), %st |
| 82 | +; X86-NEXT: fstp %st(1) |
| 83 | +; X86-NEXT: retl |
| 84 | +; |
| 85 | +; X86-GISEL-LABEL: cmove_arg: |
| 86 | +; X86-GISEL: # %bb.0: |
| 87 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 88 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 89 | +; X86-GISEL-NEXT: fadd %st, %st(1) |
| 90 | +; X86-GISEL-NEXT: movl $1, %eax |
| 91 | +; X86-GISEL-NEXT: andl {{[0-9]+}}(%esp), %eax |
| 92 | +; X86-GISEL-NEXT: testl %eax, %eax |
| 93 | +; X86-GISEL-NEXT: fxch %st(1) |
| 94 | +; X86-GISEL-NEXT: fcmove %st(1), %st |
| 95 | +; X86-GISEL-NEXT: fstp %st(1) |
| 96 | +; X86-GISEL-NEXT: retl |
| 97 | +; |
| 98 | +; X64-LABEL: cmove_arg: |
| 99 | +; X64: # %bb.0: |
| 100 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 101 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 102 | +; X64-NEXT: fadd %st(1), %st |
| 103 | +; X64-NEXT: testb $1, %dil |
| 104 | +; X64-NEXT: fxch %st(1) |
| 105 | +; X64-NEXT: fcmovne %st(1), %st |
| 106 | +; X64-NEXT: fstp %st(1) |
| 107 | +; X64-NEXT: retq |
| 108 | +; |
| 109 | +; X64-GISEL-LABEL: cmove_arg: |
| 110 | +; X64-GISEL: # %bb.0: |
| 111 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 112 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 113 | +; X64-GISEL-NEXT: fadd %st, %st(1) |
| 114 | +; X64-GISEL-NEXT: andl $1, %edi |
| 115 | +; X64-GISEL-NEXT: testl %edi, %edi |
| 116 | +; X64-GISEL-NEXT: fxch %st(1) |
| 117 | +; X64-GISEL-NEXT: fcmove %st(1), %st |
| 118 | +; X64-GISEL-NEXT: fstp %st(1) |
| 119 | +; X64-GISEL-NEXT: retq |
| 120 | + %add = fadd x86_fp80 %a, %b |
| 121 | + %ret = select i1 %test, x86_fp80 %add, x86_fp80 %b |
| 122 | + ret x86_fp80 %ret |
| 123 | +} |
| 124 | + |
| 125 | +define x86_fp80 @cmove_load(x86_fp80 %a, x86_fp80 %b, ptr %p) { |
| 126 | +; X86-LABEL: cmove_load: |
| 127 | +; X86: # %bb.0: |
| 128 | +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 129 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 130 | +; X86-NEXT: fldt {{[0-9]+}}(%esp) |
| 131 | +; X86-NEXT: fadd %st(1), %st |
| 132 | +; X86-NEXT: cmpb $0, (%eax) |
| 133 | +; X86-NEXT: fxch %st(1) |
| 134 | +; X86-NEXT: fcmovne %st(1), %st |
| 135 | +; X86-NEXT: fstp %st(1) |
| 136 | +; X86-NEXT: retl |
| 137 | +; |
| 138 | +; X86-GISEL-LABEL: cmove_load: |
| 139 | +; X86-GISEL: # %bb.0: |
| 140 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 141 | +; X86-GISEL-NEXT: fldt {{[0-9]+}}(%esp) |
| 142 | +; X86-GISEL-NEXT: movl {{[0-9]+}}(%esp), %eax |
| 143 | +; X86-GISEL-NEXT: fadd %st, %st(1) |
| 144 | +; X86-GISEL-NEXT: movzbl (%eax), %eax |
| 145 | +; X86-GISEL-NEXT: andl $1, %eax |
| 146 | +; X86-GISEL-NEXT: testl %eax, %eax |
| 147 | +; X86-GISEL-NEXT: fxch %st(1) |
| 148 | +; X86-GISEL-NEXT: fcmove %st(1), %st |
| 149 | +; X86-GISEL-NEXT: fstp %st(1) |
| 150 | +; X86-GISEL-NEXT: retl |
| 151 | +; |
| 152 | +; X64-LABEL: cmove_load: |
| 153 | +; X64: # %bb.0: |
| 154 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 155 | +; X64-NEXT: fldt {{[0-9]+}}(%rsp) |
| 156 | +; X64-NEXT: fadd %st(1), %st |
| 157 | +; X64-NEXT: cmpb $0, (%rdi) |
| 158 | +; X64-NEXT: fxch %st(1) |
| 159 | +; X64-NEXT: fcmovne %st(1), %st |
| 160 | +; X64-NEXT: fstp %st(1) |
| 161 | +; X64-NEXT: retq |
| 162 | +; |
| 163 | +; X64-GISEL-LABEL: cmove_load: |
| 164 | +; X64-GISEL: # %bb.0: |
| 165 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 166 | +; X64-GISEL-NEXT: fldt {{[0-9]+}}(%rsp) |
| 167 | +; X64-GISEL-NEXT: fadd %st, %st(1) |
| 168 | +; X64-GISEL-NEXT: movzbl (%rdi), %eax |
| 169 | +; X64-GISEL-NEXT: andl $1, %eax |
| 170 | +; X64-GISEL-NEXT: testl %eax, %eax |
| 171 | +; X64-GISEL-NEXT: fxch %st(1) |
| 172 | +; X64-GISEL-NEXT: fcmove %st(1), %st |
| 173 | +; X64-GISEL-NEXT: fstp %st(1) |
| 174 | +; X64-GISEL-NEXT: retq |
| 175 | + %test = load i1, ptr %p |
| 176 | + %add = fadd x86_fp80 %a, %b |
| 177 | + %ret = select i1 %test, x86_fp80 %add, x86_fp80 %b |
| 178 | + ret x86_fp80 %ret |
| 179 | +} |
0 commit comments