Sanjay Patel | 2ee7b93 | 2018-03-08 20:42:49 +0000 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
Aditya Nandakumar | 12d0604 | 2016-01-04 19:48:14 +0000 | [diff] [blame] | 2 | ; RUN: opt -S -reassociate < %s | FileCheck %s |
| 3 | |
Aditya Nandakumar | 12d0604 | 2016-01-04 19:48:14 +0000 | [diff] [blame] | 4 | define void @main(float, float) { |
Sanjay Patel | c019c39 | 2017-11-09 18:26:49 +0000 | [diff] [blame] | 5 | ; CHECK-LABEL: @main( |
| 6 | ; CHECK-NEXT: wrapper_entry: |
Sanjay Patel | 2ee7b93 | 2018-03-08 20:42:49 +0000 | [diff] [blame] | 7 | ; CHECK-NEXT: [[TMP2:%.*]] = fsub float undef, [[TMP0:%.*]] |
| 8 | ; CHECK-NEXT: [[TMP3:%.*]] = fsub float undef, [[TMP1:%.*]] |
Sanjay Patel | c019c39 | 2017-11-09 18:26:49 +0000 | [diff] [blame] | 9 | ; CHECK-NEXT: [[TMP4:%.*]] = call float @llvm.rsqrt.f32(float undef) |
| 10 | ; CHECK-NEXT: [[REASS_ADD2:%.*]] = fadd fast float [[TMP3]], [[TMP2]] |
Sanjay Patel | 2ee7b93 | 2018-03-08 20:42:49 +0000 | [diff] [blame] | 11 | ; CHECK-NEXT: [[REASS_MUL3:%.*]] = fmul fast float [[TMP4]], [[REASS_ADD2]] |
| 12 | ; CHECK-NEXT: [[REASS_ADD1:%.*]] = fadd fast float [[REASS_MUL3]], [[TMP4]] |
| 13 | ; CHECK-NEXT: [[REASS_MUL:%.*]] = fmul fast float [[REASS_ADD1]], undef |
Sanjay Patel | c019c39 | 2017-11-09 18:26:49 +0000 | [diff] [blame] | 14 | ; CHECK-NEXT: [[TMP5:%.*]] = call float @foo2(float [[REASS_MUL]], float 0.000000e+00) |
| 15 | ; CHECK-NEXT: [[MUL36:%.*]] = fmul fast float [[TMP5]], 1.500000e+00 |
| 16 | ; CHECK-NEXT: call void @foo1(i32 4, float [[MUL36]]) |
| 17 | ; CHECK-NEXT: ret void |
| 18 | ; |
Aditya Nandakumar | 12d0604 | 2016-01-04 19:48:14 +0000 | [diff] [blame] | 19 | wrapper_entry: |
| 20 | %2 = fsub float undef, %0 |
| 21 | %3 = fsub float undef, %1 |
| 22 | %4 = call float @llvm.rsqrt.f32(float undef) |
| 23 | %5 = fmul fast float undef, %4 |
| 24 | %6 = fmul fast float %2, %4 |
| 25 | %7 = fmul fast float %3, %4 |
| 26 | %8 = fmul fast float %5, undef |
| 27 | %9 = fmul fast float %6, undef |
| 28 | %10 = fmul fast float %7, undef |
| 29 | %11 = fadd fast float %8, %9 |
| 30 | %12 = fadd fast float %11, %10 |
| 31 | %13 = call float @foo2(float %12, float 0.000000e+00) |
| 32 | %mul36 = fmul fast float %13, 1.500000e+00 |
| 33 | call void @foo1(i32 4, float %mul36) |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | declare void @foo1(i32, float) |
| 38 | |
| 39 | declare float @foo2(float, float) #1 |
| 40 | |
| 41 | declare float @llvm.rsqrt.f32(float) #1 |
| 42 | |
| 43 | attributes #0 = { argmemonly nounwind } |
| 44 | attributes #1 = { nounwind readnone } |
| 45 | |