Index: llvm/lib/Target/PowerPC/PPCInstrAltivec.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrAltivec.td +++ llvm/lib/Target/PowerPC/PPCInstrAltivec.td @@ -821,7 +821,9 @@ def VCMPGTUW : VCMP <646, "vcmpgtuw $vD, $vA, $vB" , v4i32>; def VCMPGTUWo : VCMPo<646, "vcmpgtuw. $vD, $vA, $vB", v4i32>; -let isCodeGenOnly = 1 in { +let isCodeGenOnly = 1, isMoveImm = 1, isAsCheapAsAMove = 1, + isReMaterializable = 1 in { + def V_SET0B : VXForm_setzero<1220, (outs vrrc:$vD), (ins), "vxor $vD, $vD, $vD", IIC_VecFP, [(set v16i8:$vD, (v16i8 immAllZerosV))]>; Index: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrInfo.cpp +++ llvm/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -332,6 +332,15 @@ case PPC::ADDIStocHA: case PPC::ADDItocL: case PPC::LOAD_STACK_GUARD: + case PPC::XXLXORz: + case PPC::XXLXORspz: + case PPC::XXLXORdpz: + case PPC::V_SET0B: + case PPC::V_SET0H: + case PPC::V_SET0: + case PPC::V_SETALLONESB: + case PPC::V_SETALLONESH: + case PPC::V_SETALLONES: return true; } return false; Index: llvm/lib/Target/PowerPC/PPCInstrVSX.td =================================================================== --- llvm/lib/Target/PowerPC/PPCInstrVSX.td +++ llvm/lib/Target/PowerPC/PPCInstrVSX.td @@ -840,12 +840,12 @@ "xxlxor $XT, $XA, $XB", IIC_VecGeneral, [(set v4i32:$XT, (xor v4i32:$XA, v4i32:$XB))]>; } // isCommutable - let isCodeGenOnly = 1 in - def XXLXORz : XX3Form_Zero<60, 154, (outs vsrc:$XT), (ins), + + let isCodeGenOnly = 1, isMoveImm = 1, isAsCheapAsAMove = 1, + isReMaterializable = 1 in { + def XXLXORz : XX3Form_Zero<60, 154, (outs vsrc:$XT), (ins), "xxlxor $XT, $XT, $XT", IIC_VecGeneral, [(set v4i32:$XT, (v4i32 immAllZerosV))]>; - - let isCodeGenOnly = 1 in { def XXLXORdpz : XX3Form_SetZero<60, 154, (outs vsfrc:$XT), (ins), "xxlxor $XT, $XT, $XT", IIC_VecGeneral, Index: llvm/test/CodeGen/PowerPC/optimize-andiso.ll =================================================================== --- llvm/test/CodeGen/PowerPC/optimize-andiso.ll +++ llvm/test/CodeGen/PowerPC/optimize-andiso.ll @@ -6,11 +6,9 @@ define float @floatundisf(i64 %a) { ; CHECK-LABEL: floatundisf: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: bc 4, 4*cr5+lt, .LBB0_2 -; CHECK-NEXT: # %bb.1: ; CHECK-NEXT: xxlxor f1, f1, f1 -; CHECK-NEXT: blr -; CHECK-NEXT: .LBB0_2: # %sw.epilog +; CHECK-NEXT: bclr 12, 4*cr5+lt, 0 +; CHECK-NEXT: # %bb.1: # %sw.epilog ; CHECK-NEXT: addi r3, r3, 1 ; CHECK-NEXT: li r5, 2 ; CHECK-NEXT: andis. r4, r3, 1024 Index: llvm/test/CodeGen/PowerPC/pr36292.ll =================================================================== --- llvm/test/CodeGen/PowerPC/pr36292.ll +++ llvm/test/CodeGen/PowerPC/pr36292.ll @@ -1,3 +1,4 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown < %s | \ ; RUN: FileCheck %s --implicit-check-not=mtctr --implicit-check-not=bdnz $test = comdat any @@ -5,15 +6,25 @@ ; No CTR loop due to frem (since it is always a call). define void @test() #0 comdat { ; CHECK-LABEL: test: -; CHECK: ld 29, 0(3) -; CHECK: ld 30, 40(1) -; CHECK: xxlxor 31, 31, 31 -; CHECK: cmpld 30, 29 +; CHECK: # %bb.0: +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -64(1) +; CHECK-NEXT: .cfi_def_cfa_offset 64 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: .cfi_offset r29, -24 +; CHECK-NEXT: .cfi_offset r30, -16 +; CHECK-NEXT: std 29, 40(1) # 8-byte Folded Spill +; CHECK-NEXT: std 30, 48(1) # 8-byte Folded Spill +; CHECK-NEXT: ld 29, 0(3) +; CHECK-NEXT: ld 30, 32(1) +; CHECK-NEXT: cmpld 30, 29 ; CHECK-NEXT: bge- 0, .LBB0_2 ; CHECK-NEXT: .p2align 5 ; CHECK-NEXT: .LBB0_1: # %bounds.ok -; CHECK: fmr 1, 31 +; CHECK-NEXT: # =>This Inner Loop Header: Depth=1 ; CHECK-NEXT: lfsx 2, 0, 3 +; CHECK-NEXT: xxlxor 1, 1, 1 ; CHECK-NEXT: bl fmodf ; CHECK-NEXT: nop ; CHECK-NEXT: addi 30, 30, 1 @@ -21,7 +32,7 @@ ; CHECK-NEXT: cmpld 30, 29 ; CHECK-NEXT: blt+ 0, .LBB0_1 ; CHECK-NEXT: .LBB0_2: # %bounds.fail -; CHECK-NEXT: std 30, 40(1) +; CHECK-NEXT: std 30, 32(1) %pos = alloca i64, align 8 br label %forcond Index: llvm/test/CodeGen/PowerPC/vsx-infl-copy1.ll =================================================================== --- llvm/test/CodeGen/PowerPC/vsx-infl-copy1.ll +++ llvm/test/CodeGen/PowerPC/vsx-infl-copy1.ll @@ -11,15 +11,11 @@ br label %vector.body ; CHECK-LABEL: @_Z8example9Pj -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr -; CHECK: vmr +; CHECK: xxlxor +; CHECK: xxlxor +; CHECK: xxlxor +; CHECK: xxlxor +; CHECK: xxlxor vector.body: ; preds = %vector.body, %entry %index = phi i64 [ 0, %entry ], [ %index.next, %vector.body ]