| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 2 | ; RUN: opt < %s -instsimplify -S | FileCheck %s |
| 3 | |
| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 4 | define float @fdiv_constant_fold() { |
| 5 | ; CHECK-LABEL: @fdiv_constant_fold( |
| Sanjay Patel | 8b5ad3f | 2017-04-01 19:05:11 +0000 | [diff] [blame] | 6 | ; CHECK-NEXT: ret float 1.500000e+00 |
| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 7 | ; |
| 8 | %f = fdiv float 3.0, 2.0 |
| 9 | ret float %f |
| 10 | } |
| 11 | |
| 12 | define float @frem_constant_fold() { |
| 13 | ; CHECK-LABEL: @frem_constant_fold( |
| Sanjay Patel | 8b5ad3f | 2017-04-01 19:05:11 +0000 | [diff] [blame] | 14 | ; CHECK-NEXT: ret float 1.000000e+00 |
| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 15 | ; |
| 16 | %f = frem float 3.0, 2.0 |
| 17 | ret float %f |
| 18 | } |
| 19 | |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 20 | define double @fdiv_of_undef(double %X) { |
| Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 21 | ; CHECK-LABEL: @fdiv_of_undef( |
| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 22 | ; CHECK-NEXT: ret double undef |
| Sanjay Patel | 6963244 | 2016-03-25 20:12:25 +0000 | [diff] [blame] | 23 | ; |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 24 | ; undef / X -> undef |
| 25 | %r = fdiv double undef, %X |
| 26 | ret double %r |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | define double @fdiv_by_undef(double %X) { |
| Stephen Lin | c1c7a13 | 2013-07-14 01:42:54 +0000 | [diff] [blame] | 30 | ; CHECK-LABEL: @fdiv_by_undef( |
| Sanjay Patel | ee0f5cc | 2017-04-01 18:44:03 +0000 | [diff] [blame] | 31 | ; CHECK-NEXT: ret double undef |
| Sanjay Patel | 6963244 | 2016-03-25 20:12:25 +0000 | [diff] [blame] | 32 | ; |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 33 | ; X / undef -> undef |
| 34 | %r = fdiv double %X, undef |
| 35 | ret double %r |
| Frits van Bommel | c254966 | 2011-01-29 15:26:31 +0000 | [diff] [blame] | 36 | } |