[PATCH] D13284: [ PowerPC ] Remove FeatureMFOCRF from the e500mc ProcessorModel.

Tom Rix via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 4 08:53:29 PDT 2015


trixirt updated the summary for this revision.
trixirt updated this revision to Diff 36469.
trixirt added a comment.

A testcase distilled from the original problem.
Checks that mfocrf is not used.
Since checking for something not present is brittle, add a positve check.
The second check appends -mattr+mfocrf to the compile arg.
This manually adds back the removed feature and the generated code is
checked for the mfocrf insn.


http://reviews.llvm.org/D13284

Files:
  lib/Target/PowerPC/PPC.td
  test/CodeGen/PowerPC/e500-1.ll

Index: test/CodeGen/PowerPC/e500-1.ll
===================================================================
--- /dev/null
+++ test/CodeGen/PowerPC/e500-1.ll
@@ -0,0 +1,31 @@
+;
+; Check if e500 generates code with mfocrf insn.
+;
+; RUN: llc < %s -mcpu=e500mc -O 0 -o %t
+; RUN: not grep mfocrf %t
+; RUN: llc < %s -mcpu=e500mc -mattr=+mfocrf -O 0 -o %t
+; RUN: grep mfocrf %t
+target datalayout = "E-m:e-p:32:32-i64:64-n32"
+target triple = "powerpc-unknown-linux-gnu"
+
+define internal i32 @func_49(i64 %p_50, i16 zeroext %p_51, i8* %p_52, i32 %p_53) {
+  %1 = load i64, i64* undef, align 8
+  %2 = load i64, i64* undef, align 8
+  %3 = icmp sge i32 undef, undef
+  %4 = zext i1 %3 to i32
+  %5 = sext i32 %4 to i64
+  %6 = icmp slt i64 %2, %5
+  %7 = zext i1 %6 to i32
+  %8 = call i64 @safe_sub_func_int64_t_s_s(i64 -6372137293439783564, i64 undef)
+  %9 = icmp slt i32 %7, undef
+  %10 = zext i1 %9 to i32
+  %11 = sext i32 %10 to i64
+  %12 = icmp sle i64 %1, %11
+  %13 = zext i1 %12 to i32
+  %14 = call i32 @safe_add_func_int32_t_s_s(i32 undef, i32 %13)
+  ret i32 undef
+}
+
+declare i32 @safe_add_func_int32_t_s_s(i32, i32)
+
+declare i64 @safe_sub_func_int64_t_s_s(i64, i64)
Index: lib/Target/PowerPC/PPC.td
===================================================================
--- lib/Target/PowerPC/PPC.td
+++ lib/Target/PowerPC/PPC.td
@@ -309,7 +309,7 @@
                    Feature64Bit /*, Feature64BitRegs */,
                    FeatureMFTB, DeprecatedDST]>;
 def : ProcessorModel<"e500mc", PPCE500mcModel,
-                  [DirectiveE500mc, FeatureMFOCRF,
+                  [DirectiveE500mc,
                    FeatureSTFIWX, FeatureICBT, FeatureBookE, 
                    FeatureISEL, FeatureMFTB]>;
 def : ProcessorModel<"e5500", PPCE5500Model,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13284.36469.patch
Type: text/x-patch
Size: 1769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151004/a384bf41/attachment.bin>


More information about the llvm-commits mailing list