diff options
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCInstrAltivec.td | 9 | ||||
-rw-r--r-- | llvm/test/CodeGen/PowerPC/vsx-p9.ll | 22 |
2 files changed, 29 insertions, 2 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td index f9a500bea17..a2787f88329 100644 --- a/llvm/lib/Target/PowerPC/PPCInstrAltivec.td +++ b/llvm/lib/Target/PowerPC/PPCInstrAltivec.td @@ -1315,8 +1315,13 @@ let isCodeGenOnly = 1 in { } // Vector Integer Negate -def VNEGW : VX_VT5_EO5_VB5<1538, 6, "vnegw", []>; -def VNEGD : VX_VT5_EO5_VB5<1538, 7, "vnegd", []>; +def VNEGW : VX_VT5_EO5_VB5<1538, 6, "vnegw", + [(set v4i32:$vD, + (sub (v4i32 immAllZerosV), v4i32:$vB))]>; + +def VNEGD : VX_VT5_EO5_VB5<1538, 7, "vnegd", + [(set v2i64:$vD, + (sub (v2i64 (bitconvert (v4i32 immAllZerosV))), v2i64:$vB))]>; // Vector Parity Byte def VPRTYBW : VX_VT5_EO5_VB5<1538, 8, "vprtybw", [(set v4i32:$vD, diff --git a/llvm/test/CodeGen/PowerPC/vsx-p9.ll b/llvm/test/CodeGen/PowerPC/vsx-p9.ll index b0c6e851353..e8a0a3bcf92 100644 --- a/llvm/test/CodeGen/PowerPC/vsx-p9.ll +++ b/llvm/test/CodeGen/PowerPC/vsx-p9.ll @@ -388,4 +388,26 @@ entry: ; Function Attrs: nounwind readnone declare void @llvm.ppc.vsx.stxvll(<4 x i32>, i8*, i64) +define <4 x i32> @test0(<4 x i32> %a) local_unnamed_addr #0 { +entry: + %sub.i = sub <4 x i32> zeroinitializer, %a + ret <4 x i32> %sub.i + +; CHECK-LABEL: @test0 +; CHECK: vnegw 2, 2 +; CHECK: blr + +} + +define <2 x i64> @test1(<2 x i64> %a) local_unnamed_addr #0 { +entry: + %sub.i = sub <2 x i64> zeroinitializer, %a + ret <2 x i64> %sub.i + +; CHECK-LABEL: @test1 +; CHECK: vnegd 2, 2 +; CHECK: blr + +} + declare void @sink(...) |