From 97658211eb3038b7679e062990dd23623ab37e88 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 14 Jan 2017 18:52:13 +0000 Subject: [PATCH] [X86][XOP] Added support for VPMADCSWD 'extend+hadd' IFMA patterns VPMADCSWD act as VPADDD( VPMADDWD( x, y ), z ) - multiply+extend+hadd and add to v4i32 accumulator git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292021 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrXOP.td | 3 +++ test/CodeGen/X86/xop-ifma.ll | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Target/X86/X86InstrXOP.td b/lib/Target/X86/X86InstrXOP.td index 85945e7794f..10acdca2df7 100644 --- a/lib/Target/X86/X86InstrXOP.td +++ b/lib/Target/X86/X86InstrXOP.td @@ -199,6 +199,9 @@ let Predicates = [HasXOP] in { def : Pat<(v2i64 (add (X86pmuldq (v4i32 VR128:$src1), (v4i32 VR128:$src2)), (v2i64 VR128:$src3))), (VPMACSDQLrr VR128:$src1, VR128:$src2, VR128:$src3)>; + def : Pat<(v4i32 (add (X86vpmaddwd (v8i16 VR128:$src1), (v8i16 VR128:$src2)), + (v4i32 VR128:$src3))), + (VPMADCSWDrr VR128:$src1, VR128:$src2, VR128:$src3)>; } // Instruction where second source can be memory, third must be imm8 diff --git a/test/CodeGen/X86/xop-ifma.ll b/test/CodeGen/X86/xop-ifma.ll index a362dcdf257..83291095b87 100644 --- a/test/CodeGen/X86/xop-ifma.ll +++ b/test/CodeGen/X86/xop-ifma.ll @@ -118,8 +118,7 @@ define <2 x i64> @test_pmuldq_hi_v4i32_add_v2i64(<4 x i32> %a0, <4 x i32> %a1, < define <4 x i32> @test_pmaddwd_v8i16_add_v4i32(<8 x i16> %a0, <8 x i16> %a1, <4 x i32> %a2) { ; XOP-LABEL: test_pmaddwd_v8i16_add_v4i32: ; XOP: # BB#0: -; XOP-NEXT: vpmaddwd %xmm1, %xmm0, %xmm0 -; XOP-NEXT: vpaddd %xmm2, %xmm0, %xmm0 +; XOP-NEXT: vpmadcswd %xmm2, %xmm1, %xmm0, %xmm0 ; XOP-NEXT: retq %1 = call <4 x i32> @llvm.x86.sse2.pmadd.wd(<8 x i16> %a0, <8 x i16> %a1) %2 = add <4 x i32> %1, %a2 -- 2.40.0