[PATCH] D14971: X86: Emit smaller code for moving 8-bit immediates

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 13:02:07 PST 2015


hans added a comment.

In http://reviews.llvm.org/D14971#296355, @mkuper wrote:

> In http://reviews.llvm.org/D14971#296239, @joerg wrote:
>
> > About the patch, this should be CFI instrumentation if we ever want to go towards instruction precise .eh_frame.
>
>
> The end result of the discussion of r251904 was that we're moving in that direction. See http://reviews.llvm.org/D14948.


Thanks for pointing this out. I've uploaded a new patch that emits CFI, but this is not something I'm really familiar so please take a look at it.


================
Comment at: lib/Target/X86/X86InstrInfo.cpp:5289
@@ -5263,1 +5288,3 @@
+  case X86::MOV64ImmSExti8:
+    return ExpandMOVImmSExti8(MIB, *this);
   case X86::SETB_C8r:
----------------
mkuper wrote:
> I know this is all over the file, but it's kind of odd.
> Any particular reason you can think of that all these static functions that receive a *this parameter aren't private members instead?
I'll make it a member instead.

================
Comment at: test/CodeGen/X86/movtopush.ll:117
@@ -116,2 +116,3 @@
 ; NORMAL-LABEL: test4:
-; NORMAL: movl    $2, %eax
+; NORMAL: pushl $2
+; NORMAL: popl %eax
----------------
mkuper wrote:
> Ha. This looks positively silly. Probably the right thing to do (this is what ICC does here as well), but, nonetheless, silly. :-)
If you want silly, check out this one :-)

  long long f() { return -2; }

built with -Os -m32, ICC (and Clang with my patch) emit:

        pushl   $-2
        popl    %eax
        pushl   $-1
        popl    %edx
        retl

Maybe we could use CDQ instead there?


http://reviews.llvm.org/D14971





More information about the llvm-commits mailing list