1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i686-- -x86-asm-syntax=intel | FileCheck %s 3 4; Test that the load of the memory location is folded into the operation. 5 6define double @test_add(double %X, double* %P) { 7; CHECK-LABEL: test_add: 8; CHECK: # %bb.0: 9; CHECK-NEXT: mov eax, dword ptr [esp + 12] 10; CHECK-NEXT: fld qword ptr [esp + 4] 11; CHECK-NEXT: fadd qword ptr [eax] 12; CHECK-NEXT: ret 13 %Y = load double, double* %P ; <double> [#uses=1] 14 %R = fadd double %X, %Y ; <double> [#uses=1] 15 ret double %R 16} 17 18define double @test_mul(double %X, double* %P) { 19; CHECK-LABEL: test_mul: 20; CHECK: # %bb.0: 21; CHECK-NEXT: mov eax, dword ptr [esp + 12] 22; CHECK-NEXT: fld qword ptr [esp + 4] 23; CHECK-NEXT: fmul qword ptr [eax] 24; CHECK-NEXT: ret 25 %Y = load double, double* %P ; <double> [#uses=1] 26 %R = fmul double %X, %Y ; <double> [#uses=1] 27 ret double %R 28} 29 30define double @test_sub(double %X, double* %P) { 31; CHECK-LABEL: test_sub: 32; CHECK: # %bb.0: 33; CHECK-NEXT: mov eax, dword ptr [esp + 12] 34; CHECK-NEXT: fld qword ptr [esp + 4] 35; CHECK-NEXT: fsub qword ptr [eax] 36; CHECK-NEXT: ret 37 %Y = load double, double* %P ; <double> [#uses=1] 38 %R = fsub double %X, %Y ; <double> [#uses=1] 39 ret double %R 40} 41 42define double @test_subr(double %X, double* %P) { 43; CHECK-LABEL: test_subr: 44; CHECK: # %bb.0: 45; CHECK-NEXT: mov eax, dword ptr [esp + 12] 46; CHECK-NEXT: fld qword ptr [eax] 47; CHECK-NEXT: fsub qword ptr [esp + 4] 48; CHECK-NEXT: ret 49 %Y = load double, double* %P ; <double> [#uses=1] 50 %R = fsub double %Y, %X ; <double> [#uses=1] 51 ret double %R 52} 53 54define double @test_div(double %X, double* %P) { 55; CHECK-LABEL: test_div: 56; CHECK: # %bb.0: 57; CHECK-NEXT: mov eax, dword ptr [esp + 12] 58; CHECK-NEXT: fld qword ptr [esp + 4] 59; CHECK-NEXT: fdiv qword ptr [eax] 60; CHECK-NEXT: ret 61 %Y = load double, double* %P ; <double> [#uses=1] 62 %R = fdiv double %X, %Y ; <double> [#uses=1] 63 ret double %R 64} 65 66define double @test_divr(double %X, double* %P) { 67; CHECK-LABEL: test_divr: 68; CHECK: # %bb.0: 69; CHECK-NEXT: mov eax, dword ptr [esp + 12] 70; CHECK-NEXT: fld qword ptr [eax] 71; CHECK-NEXT: fdiv qword ptr [esp + 4] 72; CHECK-NEXT: ret 73 %Y = load double, double* %P ; <double> [#uses=1] 74 %R = fdiv double %Y, %X ; <double> [#uses=1] 75 ret double %R 76} 77