[PATCH] Added instruction combine to transform few more negative values addition to subtraction (Part 3)

Dinesh Dwivedi dinesh.d at samsung.com
Thu Jun 26 00:11:40 PDT 2014


I have updated patch for comments with following extra changes.
1. ADD(XOR(AND(Z, ~C), ~C), 1) == NEG(OR(Z, C)) is true for both if C is even or odd. [http://rise4fun.com/Z3/Pwkf]
2. Rearranged test cases, generated from following test code
  int test10(int x, int y) { return y + (~((x >> 3) & 0x55555555) + 1); }
  int test11(int x, int y) { return y + (~(x & 0x55555555) + 1); }
  int test12(int x, int y) { return (y + 1) + ~(x & 0x55555555); }

  int test13(int x, int y) { return y + (~(x & 0x55555556) + 1); }
  int test14(int x, int y) { return (y + 1) + ~(x & 0x55555556); }

  int test15(int x, int y) { return y + (~(x | 0x55555556) + 1); }
  int test16(int x, int y) { return (y + 1) + ~(x | 0x55555556); }

  int test17(int x, int y) { return y + (~(x | 0x55555555) + 1); }
  int test18(int x, int y) { return (y + 1) + ~(x | 0x55555555); }

http://reviews.llvm.org/D4210

Files:
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  test/Transforms/InstCombine/add2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4210.10879.patch
Type: text/x-patch
Size: 10194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140626/f060ac48/attachment.bin>


More information about the llvm-commits mailing list