brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 1585526 Raw
71 lines · plain
1; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s2; RUN: llc < %s -O3 -verify-machineinstrs -mtriple=aarch64-none-linux-gnu -mattr=+neon | FileCheck %s3 4define <2 x float> @fma_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {5; CHECK-LABEL: fma_1:6; CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s7	%tmp1 = fmul contract <2 x float> %A, %B;8	%tmp2 = fadd contract <2 x float> %C, %tmp1;9	ret <2 x float> %tmp210}11 12; This case will fold as it was only available through unsafe before, now available from13; the contract on the fadd14define <2 x float> @fma_2(<2 x float> %A, <2 x float> %B, <2 x float> %C) {15; CHECK-LABEL: fma_2:16; CHECK: fmla {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s17	%tmp1 = fmul <2 x float> %A, %B;18	%tmp2 = fadd contract <2 x float> %C, %tmp1;19	ret <2 x float> %tmp220}21 22define <2 x float> @no_fma_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {23; CHECK-LABEL: no_fma_1:24; CHECK: fmul25; CHECK: fadd26	%tmp1 = fmul contract <2 x float> %A, %B;27	%tmp2 = fadd <2 x float> %C, %tmp1;28	ret <2 x float> %tmp229}30 31define <2 x float> @fma_sub_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {32; CHECK-LABEL: fma_sub_1:33; CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s34	%tmp1 = fmul contract <2 x float> %A, %B;35	%tmp2 = fsub contract <2 x float> %C, %tmp1;36	ret <2 x float> %tmp237}38 39; This case will fold as it was only available through unsafe before, now available from40; the contract on the fsub41define <2 x float> @fma_sub_2(<2 x float> %A, <2 x float> %B, <2 x float> %C) {42; CHECK-LABEL: fma_sub_2:43; CHECK: fmls {{v[0-9]+}}.2s, {{v[0-9]+}}.2s, {{v[0-9]+}}.2s44	%tmp1 = fmul <2 x float> %A, %B;45	%tmp2 = fsub contract <2 x float> %C, %tmp1;46	ret <2 x float> %tmp247}48 49define <2 x float> @no_fma_sub_1(<2 x float> %A, <2 x float> %B, <2 x float> %C) {50; CHECK-LABEL: no_fma_sub_1:51; CHECK: fmul52; CHECK: fsub53	%tmp1 = fmul contract <2 x float> %A, %B;54	%tmp2 = fsub <2 x float> %C, %tmp1;55	ret <2 x float> %tmp256}57 58; Regression test: contract FMF allows folding (A * 0 + B) to FMA(A, 0, B), but59; reassoc FMF must not allow further folding to just (B) without additional60; FMFs (ninf, nnan)61define float @fma_zero(float %A, float %B) {62; CHECK-LABEL: fma_zero:63; CHECK:       // %bb.0:64; CHECK-NEXT:    movi d2, #000000000000000065; CHECK-NEXT:    fmadd s0, s0, s2, s166; CHECK-NEXT:    ret67	%tmp1 = fmul contract reassoc float %A, 0.0e+0;68	%tmp2 = fadd contract reassoc float %B, %tmp1;69	ret float %tmp270}71