| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 | |
| ; RUN: llc < %s --mattr=+complxnum,+neon -o - | FileCheck %s | |
| target triple = "aarch64" | |
| ; Expected to be transformed (and discard extra nnan flag) | |
| define <4 x double> @fcmla_mixed_fmf(<4 x double> %a, <4 x double> %b, <4 x double> %c) { | |
| ; CHECK-LABEL: fcmla_mixed_fmf: | |
| ; CHECK: // %bb.0: // %entry | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #0 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #0 | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #90 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #90 | |
| ; CHECK-NEXT: mov v0.16b, v4.16b | |
| ; CHECK-NEXT: mov v1.16b, v5.16b | |
| ; CHECK-NEXT: ret | |
| entry: | |
| %a.real = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %a.imag = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %b.real = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %b.imag = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %0 = fmul reassoc contract nsz <2 x double> %b.imag, %a.real | |
| %1 = fmul reassoc contract nsz <2 x double> %b.real, %a.imag | |
| %2 = fadd reassoc contract nsz nnan <2 x double> %0, %1 | |
| %3 = fmul reassoc contract nsz <2 x double> %b.real, %a.real | |
| %c.real = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %c.imag = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %4 = fadd reassoc contract nsz <2 x double> %c.real, %3 | |
| %5 = fmul reassoc contract nsz <2 x double> %b.imag, %a.imag | |
| %6 = fsub reassoc contract nsz <2 x double> %4, %5 | |
| %7 = fadd reassoc contract nsz <2 x double> %2, %c.imag | |
| %interleaved.vec = shufflevector <2 x double> %6, <2 x double> %7, <4 x i32> <i32 0, i32 2, i32 1, i32 3> | |
| ret <4 x double> %interleaved.vec | |
| } | |
| ; Expected to transform (and discard extra ninf flags) | |
| define <4 x double> @fcmla_mixed_root_fmf(<4 x double> %a, <4 x double> %b, <4 x double> %c) { | |
| ; CHECK-LABEL: fcmla_mixed_root_fmf: | |
| ; CHECK: // %bb.0: // %entry | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #0 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #0 | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #90 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #90 | |
| ; CHECK-NEXT: mov v0.16b, v4.16b | |
| ; CHECK-NEXT: mov v1.16b, v5.16b | |
| ; CHECK-NEXT: ret | |
| entry: | |
| %a.real = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %a.imag = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %b.real = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %b.imag = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %0 = fmul reassoc contract <2 x double> %b.imag, %a.real | |
| %1 = fmul reassoc contract <2 x double> %b.real, %a.imag | |
| %2 = fadd reassoc contract <2 x double> %0, %1 | |
| %3 = fmul reassoc contract <2 x double> %b.real, %a.real | |
| %c.real = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %c.imag = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %4 = fadd reassoc contract ninf <2 x double> %c.real, %3 | |
| %5 = fmul reassoc contract <2 x double> %b.imag, %a.imag | |
| %6 = fsub reassoc contract ninf <2 x double> %4, %5 | |
| %7 = fadd reassoc contract <2 x double> %2, %c.imag | |
| %interleaved.vec = shufflevector <2 x double> %6, <2 x double> %7, <4 x i32> <i32 0, i32 2, i32 1, i32 3> | |
| ret <4 x double> %interleaved.vec | |
| } | |
| ; Expected to transform | |
| define <4 x double> @fcmla_symmetric_scale_mixed_fmf(<4 x double> %a, <4 x double> %b, <4 x double> %c, double %k) { | |
| ; CHECK-LABEL: fcmla_symmetric_scale_mixed_fmf: | |
| ; CHECK: // %bb.0: // %entry | |
| ; CHECK-NEXT: // kill: def $d6 killed $d6 def $q6 | |
| ; CHECK-NEXT: fmul v1.2d, v1.2d, v6.d[0] | |
| ; CHECK-NEXT: fmul v0.2d, v0.2d, v6.d[0] | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #0 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #0 | |
| ; CHECK-NEXT: fcmla v4.2d, v0.2d, v2.2d, #90 | |
| ; CHECK-NEXT: fcmla v5.2d, v1.2d, v3.2d, #90 | |
| ; CHECK-NEXT: mov v0.16b, v4.16b | |
| ; CHECK-NEXT: mov v1.16b, v5.16b | |
| ; CHECK-NEXT: ret | |
| entry: | |
| %k.ins = insertelement <2 x double> poison, double %k, i64 0 | |
| %k.splat = shufflevector <2 x double> %k.ins, <2 x double> poison, <2 x i32> zeroinitializer | |
| %a.real = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %a.imag = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %s.real = fmul reassoc contract nsz <2 x double> %a.real, %k.splat | |
| %s.imag = fmul reassoc contract nsz nnan <2 x double> %a.imag, %k.splat | |
| %b.real = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %b.imag = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %0 = fmul reassoc contract nsz <2 x double> %b.imag, %s.real | |
| %1 = fmul reassoc contract nsz <2 x double> %b.real, %s.imag | |
| %2 = fadd reassoc contract nsz <2 x double> %0, %1 | |
| %3 = fmul reassoc contract nsz <2 x double> %b.real, %s.real | |
| %c.real = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %c.imag = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %4 = fadd reassoc contract nsz <2 x double> %c.real, %3 | |
| %5 = fmul reassoc contract nsz <2 x double> %b.imag, %s.imag | |
| %6 = fsub reassoc contract nsz <2 x double> %4, %5 | |
| %7 = fadd reassoc contract nsz <2 x double> %2, %c.imag | |
| %interleaved.vec = shufflevector <2 x double> %6, <2 x double> %7, <4 x i32> <i32 0, i32 2, i32 1, i32 3> | |
| ret <4 x double> %interleaved.vec | |
| } | |
| ; Expected not to transform | |
| define <4 x double> @fcmla_missing_reassoc(<4 x double> %a, <4 x double> %b, <4 x double> %c) { | |
| ; CHECK-LABEL: fcmla_missing_reassoc: | |
| ; CHECK: // %bb.0: // %entry | |
| ; CHECK-NEXT: zip1 v6.2d, v2.2d, v3.2d | |
| ; CHECK-NEXT: zip2 v2.2d, v2.2d, v3.2d | |
| ; CHECK-NEXT: zip2 v3.2d, v4.2d, v5.2d | |
| ; CHECK-NEXT: zip1 v4.2d, v4.2d, v5.2d | |
| ; CHECK-NEXT: zip1 v5.2d, v0.2d, v1.2d | |
| ; CHECK-NEXT: zip2 v0.2d, v0.2d, v1.2d | |
| ; CHECK-NEXT: fmla v3.2d, v5.2d, v2.2d | |
| ; CHECK-NEXT: fmla v4.2d, v5.2d, v6.2d | |
| ; CHECK-NEXT: fmla v3.2d, v0.2d, v6.2d | |
| ; CHECK-NEXT: fmls v4.2d, v0.2d, v2.2d | |
| ; CHECK-NEXT: zip1 v0.2d, v4.2d, v3.2d | |
| ; CHECK-NEXT: zip2 v1.2d, v4.2d, v3.2d | |
| ; CHECK-NEXT: ret | |
| entry: | |
| %a.real = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %a.imag = shufflevector <4 x double> %a, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %b.real = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %b.imag = shufflevector <4 x double> %b, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %0 = fmul nsz <2 x double> %b.imag, %a.real | |
| %1 = fmul reassoc contract <2 x double> %b.real, %a.imag | |
| %2 = fadd reassoc contract <2 x double> %0, %1 | |
| %3 = fmul reassoc contract <2 x double> %b.real, %a.real | |
| %c.real = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 0, i32 2> | |
| %c.imag = shufflevector <4 x double> %c, <4 x double> poison, <2 x i32> <i32 1, i32 3> | |
| %4 = fadd reassoc contract <2 x double> %c.real, %3 | |
| %5 = fmul reassoc contract <2 x double> %b.imag, %a.imag | |
| %6 = fsub reassoc contract <2 x double> %4, %5 | |
| %7 = fadd reassoc contract <2 x double> %2, %c.imag | |
| %interleaved.vec = shufflevector <2 x double> %6, <2 x double> %7, <4 x i32> <i32 0, i32 2, i32 1, i32 3> | |
| ret <4 x double> %interleaved.vec | |
| } |