Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llvm-dis | FileCheck %s |
| 2 | ; RUN: opt -S < %s | FileCheck %s |
Duncan P. N. Exon Smith | c8eccd1 | 2014-08-19 21:08:27 +0000 | [diff] [blame] | 3 | ; RUN: verify-uselistorder %s |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 4 | |
| 5 | @addr = external global i64 |
| 6 | @select = external global i1 |
| 7 | @vec = external global <3 x float> |
| 8 | @arr = external global [3 x float] |
| 9 | |
Sanjay Patel | 629c411 | 2017-11-06 16:27:15 +0000 | [diff] [blame] | 10 | declare float @foo(float) |
| 11 | |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 12 | define float @none(float %x, float %y) { |
| 13 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 14 | ; CHECK: %vec = load <3 x float>, <3 x float>* @vec |
| 15 | %vec = load <3 x float>, <3 x float>* @vec |
| 16 | ; CHECK: %select = load i1, i1* @select |
| 17 | %select = load i1, i1* @select |
| 18 | ; CHECK: %arr = load [3 x float], [3 x float]* @arr |
| 19 | %arr = load [3 x float], [3 x float]* @arr |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 20 | |
| 21 | ; CHECK: %a = fadd float %x, %y |
| 22 | %a = fadd float %x, %y |
| 23 | ; CHECK: %a_vec = fadd <3 x float> %vec, %vec |
| 24 | %a_vec = fadd <3 x float> %vec, %vec |
| 25 | ; CHECK: %b = fsub float %x, %y |
| 26 | %b = fsub float %x, %y |
| 27 | ; CHECK: %b_vec = fsub <3 x float> %vec, %vec |
| 28 | %b_vec = fsub <3 x float> %vec, %vec |
| 29 | ; CHECK: %c = fmul float %x, %y |
| 30 | %c = fmul float %x, %y |
| 31 | ; CHECK: %c_vec = fmul <3 x float> %vec, %vec |
| 32 | %c_vec = fmul <3 x float> %vec, %vec |
| 33 | ; CHECK: %d = fdiv float %x, %y |
| 34 | %d = fdiv float %x, %y |
| 35 | ; CHECK: %d_vec = fdiv <3 x float> %vec, %vec |
| 36 | %d_vec = fdiv <3 x float> %vec, %vec |
| 37 | ; CHECK: %e = frem float %x, %y |
| 38 | %e = frem float %x, %y |
| 39 | ; CHECK: %e_vec = frem <3 x float> %vec, %vec |
| 40 | %e_vec = frem <3 x float> %vec, %vec |
| 41 | ; CHECK: ret float %e |
| 42 | ret float %e |
| 43 | } |
| 44 | |
| 45 | ; CHECK: no_nan |
| 46 | define float @no_nan(float %x, float %y) { |
| 47 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 48 | ; CHECK: %vec = load <3 x float>, <3 x float>* @vec |
| 49 | %vec = load <3 x float>, <3 x float>* @vec |
| 50 | ; CHECK: %select = load i1, i1* @select |
| 51 | %select = load i1, i1* @select |
| 52 | ; CHECK: %arr = load [3 x float], [3 x float]* @arr |
| 53 | %arr = load [3 x float], [3 x float]* @arr |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 54 | |
| 55 | ; CHECK: %a = fadd nnan float %x, %y |
| 56 | %a = fadd nnan float %x, %y |
| 57 | ; CHECK: %a_vec = fadd nnan <3 x float> %vec, %vec |
| 58 | %a_vec = fadd nnan <3 x float> %vec, %vec |
| 59 | ; CHECK: %b = fsub nnan float %x, %y |
| 60 | %b = fsub nnan float %x, %y |
| 61 | ; CHECK: %b_vec = fsub nnan <3 x float> %vec, %vec |
| 62 | %b_vec = fsub nnan <3 x float> %vec, %vec |
| 63 | ; CHECK: %c = fmul nnan float %x, %y |
| 64 | %c = fmul nnan float %x, %y |
| 65 | ; CHECK: %c_vec = fmul nnan <3 x float> %vec, %vec |
| 66 | %c_vec = fmul nnan <3 x float> %vec, %vec |
| 67 | ; CHECK: %d = fdiv nnan float %x, %y |
| 68 | %d = fdiv nnan float %x, %y |
| 69 | ; CHECK: %d_vec = fdiv nnan <3 x float> %vec, %vec |
| 70 | %d_vec = fdiv nnan <3 x float> %vec, %vec |
| 71 | ; CHECK: %e = frem nnan float %x, %y |
| 72 | %e = frem nnan float %x, %y |
| 73 | ; CHECK: %e_vec = frem nnan <3 x float> %vec, %vec |
| 74 | %e_vec = frem nnan <3 x float> %vec, %vec |
| 75 | ; CHECK: ret float %e |
| 76 | ret float %e |
| 77 | } |
| 78 | |
Adam Nemet | cd847a8 | 2017-03-28 20:11:52 +0000 | [diff] [blame] | 79 | ; CHECK: @contract( |
| 80 | define float @contract(float %x, float %y) { |
| 81 | entry: |
| 82 | ; CHECK: %a = fsub contract float %x, %y |
| 83 | %a = fsub contract float %x, %y |
| 84 | ; CHECK: %b = fadd contract float %x, %y |
| 85 | %b = fadd contract float %x, %y |
| 86 | ; CHECK: %c = fmul contract float %a, %b |
| 87 | %c = fmul contract float %a, %b |
| 88 | ret float %c |
| 89 | } |
| 90 | |
Sanjay Patel | 629c411 | 2017-11-06 16:27:15 +0000 | [diff] [blame] | 91 | ; CHECK: @reassoc( |
| 92 | define float @reassoc(float %x, float %y) { |
| 93 | ; CHECK: %a = fsub reassoc float %x, %y |
| 94 | %a = fsub reassoc float %x, %y |
| 95 | ; CHECK: %b = fmul reassoc float %x, %y |
| 96 | %b = fmul reassoc float %x, %y |
| 97 | ; CHECK: %c = call reassoc float @foo(float %b) |
| 98 | %c = call reassoc float @foo(float %b) |
| 99 | ret float %c |
| 100 | } |
| 101 | |
| 102 | ; CHECK: @afn( |
| 103 | define float @afn(float %x, float %y) { |
| 104 | ; CHECK: %a = fdiv afn float %x, %y |
| 105 | %a = fdiv afn float %x, %y |
| 106 | ; CHECK: %b = frem afn float %x, %y |
| 107 | %b = frem afn float %x, %y |
| 108 | ; CHECK: %c = call afn float @foo(float %b) |
| 109 | %c = call afn float @foo(float %b) |
| 110 | ret float %c |
| 111 | } |
| 112 | |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 113 | ; CHECK: no_nan_inf |
| 114 | define float @no_nan_inf(float %x, float %y) { |
| 115 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 116 | ; CHECK: %vec = load <3 x float>, <3 x float>* @vec |
| 117 | %vec = load <3 x float>, <3 x float>* @vec |
| 118 | ; CHECK: %select = load i1, i1* @select |
| 119 | %select = load i1, i1* @select |
| 120 | ; CHECK: %arr = load [3 x float], [3 x float]* @arr |
| 121 | %arr = load [3 x float], [3 x float]* @arr |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 122 | |
| 123 | ; CHECK: %a = fadd nnan ninf float %x, %y |
| 124 | %a = fadd ninf nnan float %x, %y |
| 125 | ; CHECK: %a_vec = fadd nnan <3 x float> %vec, %vec |
| 126 | %a_vec = fadd nnan <3 x float> %vec, %vec |
| 127 | ; CHECK: %b = fsub nnan float %x, %y |
| 128 | %b = fsub nnan float %x, %y |
| 129 | ; CHECK: %b_vec = fsub nnan ninf <3 x float> %vec, %vec |
| 130 | %b_vec = fsub ninf nnan <3 x float> %vec, %vec |
| 131 | ; CHECK: %c = fmul nnan float %x, %y |
| 132 | %c = fmul nnan float %x, %y |
| 133 | ; CHECK: %c_vec = fmul nnan <3 x float> %vec, %vec |
| 134 | %c_vec = fmul nnan <3 x float> %vec, %vec |
| 135 | ; CHECK: %d = fdiv nnan ninf float %x, %y |
| 136 | %d = fdiv ninf nnan float %x, %y |
| 137 | ; CHECK: %d_vec = fdiv nnan <3 x float> %vec, %vec |
| 138 | %d_vec = fdiv nnan <3 x float> %vec, %vec |
| 139 | ; CHECK: %e = frem nnan float %x, %y |
| 140 | %e = frem nnan float %x, %y |
| 141 | ; CHECK: %e_vec = frem nnan ninf <3 x float> %vec, %vec |
| 142 | %e_vec = frem ninf nnan <3 x float> %vec, %vec |
| 143 | ; CHECK: ret float %e |
| 144 | ret float %e |
| 145 | } |
| 146 | |
| 147 | ; CHECK: mixed_flags |
| 148 | define float @mixed_flags(float %x, float %y) { |
| 149 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 150 | ; CHECK: %vec = load <3 x float>, <3 x float>* @vec |
| 151 | %vec = load <3 x float>, <3 x float>* @vec |
| 152 | ; CHECK: %select = load i1, i1* @select |
| 153 | %select = load i1, i1* @select |
| 154 | ; CHECK: %arr = load [3 x float], [3 x float]* @arr |
| 155 | %arr = load [3 x float], [3 x float]* @arr |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 156 | |
Sanjay Patel | 629c411 | 2017-11-06 16:27:15 +0000 | [diff] [blame] | 157 | ; CHECK: %a = fadd nnan ninf afn float %x, %y |
| 158 | %a = fadd ninf nnan afn float %x, %y |
| 159 | ; CHECK: %a_vec = fadd reassoc nnan <3 x float> %vec, %vec |
| 160 | %a_vec = fadd reassoc nnan <3 x float> %vec, %vec |
Michael Ilseman | c537743 | 2012-11-27 00:45:08 +0000 | [diff] [blame] | 161 | ; CHECK: %b = fsub fast float %x, %y |
| 162 | %b = fsub nnan nsz fast float %x, %y |
| 163 | ; CHECK: %b_vec = fsub nnan <3 x float> %vec, %vec |
| 164 | %b_vec = fsub nnan <3 x float> %vec, %vec |
| 165 | ; CHECK: %c = fmul fast float %x, %y |
| 166 | %c = fmul nsz fast arcp float %x, %y |
| 167 | ; CHECK: %c_vec = fmul nsz <3 x float> %vec, %vec |
| 168 | %c_vec = fmul nsz <3 x float> %vec, %vec |
| 169 | ; CHECK: %d = fdiv nnan ninf arcp float %x, %y |
| 170 | %d = fdiv arcp ninf nnan float %x, %y |
| 171 | ; CHECK: %d_vec = fdiv fast <3 x float> %vec, %vec |
| 172 | %d_vec = fdiv fast nnan arcp <3 x float> %vec, %vec |
| 173 | ; CHECK: %e = frem nnan nsz float %x, %y |
| 174 | %e = frem nnan nsz float %x, %y |
| 175 | ; CHECK: %e_vec = frem nnan <3 x float> %vec, %vec |
| 176 | %e_vec = frem nnan <3 x float> %vec, %vec |
| 177 | ; CHECK: ret float %e |
| 178 | ret float %e |
| 179 | } |