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
4 ; Test that the load of the memory location is folded into the operation.
6 define double @test_add(double %X, ptr %P) {
7 ; CHECK-LABEL: test_add:
9 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
10 ; CHECK-NEXT: fld qword ptr [esp + 4]
11 ; CHECK-NEXT: fadd qword ptr [eax]
13 %Y = load double, ptr %P ; <double> [#uses=1]
14 %R = fadd double %X, %Y ; <double> [#uses=1]
18 define double @test_mul(double %X, ptr %P) {
19 ; CHECK-LABEL: test_mul:
21 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
22 ; CHECK-NEXT: fld qword ptr [esp + 4]
23 ; CHECK-NEXT: fmul qword ptr [eax]
25 %Y = load double, ptr %P ; <double> [#uses=1]
26 %R = fmul double %X, %Y ; <double> [#uses=1]
30 define double @test_sub(double %X, ptr %P) {
31 ; CHECK-LABEL: test_sub:
33 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
34 ; CHECK-NEXT: fld qword ptr [esp + 4]
35 ; CHECK-NEXT: fsub qword ptr [eax]
37 %Y = load double, ptr %P ; <double> [#uses=1]
38 %R = fsub double %X, %Y ; <double> [#uses=1]
42 define double @test_subr(double %X, ptr %P) {
43 ; CHECK-LABEL: test_subr:
45 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
46 ; CHECK-NEXT: fld qword ptr [eax]
47 ; CHECK-NEXT: fsub qword ptr [esp + 4]
49 %Y = load double, ptr %P ; <double> [#uses=1]
50 %R = fsub double %Y, %X ; <double> [#uses=1]
54 define double @test_div(double %X, ptr %P) {
55 ; CHECK-LABEL: test_div:
57 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
58 ; CHECK-NEXT: fld qword ptr [esp + 4]
59 ; CHECK-NEXT: fdiv qword ptr [eax]
61 %Y = load double, ptr %P ; <double> [#uses=1]
62 %R = fdiv double %X, %Y ; <double> [#uses=1]
66 define double @test_divr(double %X, ptr %P) {
67 ; CHECK-LABEL: test_divr:
69 ; CHECK-NEXT: mov eax, dword ptr [esp + 12]
70 ; CHECK-NEXT: fld qword ptr [eax]
71 ; CHECK-NEXT: fdiv qword ptr [esp + 4]
73 %Y = load double, ptr %P ; <double> [#uses=1]
74 %R = fdiv double %Y, %X ; <double> [#uses=1]