Home | History | Annotate | Download | only in AArch64
      1 ; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s
      2 
      3 define <2 x float> @fma_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
      4 ; CHECK-LABEL: fma_1:
      5 ; CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
      6 	%tmp1 = fmul contract <2 x float> %A, %B;
      7 	%tmp2 = fadd contract <2 x float> %C, %tmp1;
      8 	ret <2 x float> %tmp2
      9 }
     10 
     11 ; This case will fold as it was only available through unsafe before, now available from
     12 ; the contract on the fadd
     13 define <2 x float> @fma_2(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
     14 ; CHECK-LABEL: fma_2:
     15 ; CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
     16 	%tmp1 = fmul <2 x float> %A, %B;
     17 	%tmp2 = fadd contract <2 x float> %C, %tmp1;
     18 	ret <2 x float> %tmp2
     19 }
     20 
     21 define <2 x float> @no_fma_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
     22 ; CHECK-LABEL: no_fma_1:
     23 ; CHECK: fmul
     24 ; CHECK: fadd
     25 	%tmp1 = fmul contract <2 x float> %A, %B;
     26 	%tmp2 = fadd <2 x float> %C, %tmp1;
     27 	ret <2 x float> %tmp2
     28 }
     29 
     30 define <2 x float> @fma_sub_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
     31 ; CHECK-LABEL: fma_sub_1:
     32 ; CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
     33 	%tmp1 = fmul contract <2 x float> %A, %B;
     34 	%tmp2 = fsub contract <2 x float> %C, %tmp1;
     35 	ret <2 x float> %tmp2
     36 }
     37 
     38 ; This case will fold as it was only available through unsafe before, now available from
     39 ; the contract on the fsub
     40 define <2 x float> @fma_sub_2(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
     41 ; CHECK-LABEL: fma_sub_2:
     42 ; CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s
     43 	%tmp1 = fmul <2 x float> %A, %B;
     44 	%tmp2 = fsub contract <2 x float> %C, %tmp1;
     45 	ret <2 x float> %tmp2
     46 }
     47 
     48 define <2 x float> @no_fma_sub_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {
     49 ; CHECK-LABEL: no_fma_sub_1:
     50 ; CHECK: fmul
     51 ; CHECK: fsub
     52 	%tmp1 = fmul contract <2 x float> %A, %B;
     53 	%tmp2 = fsub <2 x float> %C, %tmp1;
     54 	ret <2 x float> %tmp2
     55 }
     56