sparse, llvm: Add support for logical ops
commit30f5aa58c15d8a2761e703424e8400943916a065
authorPekka Enberg <penberg@kernel.org>
Mon, 26 Sep 2011 14:47:24 +0000 (26 17:47 +0300)
committerPekka Enberg <penberg@kernel.org>
Wed, 28 Sep 2011 14:11:35 +0000 (28 17:11 +0300)
treea1753de5b5c602c19e9239c2c943abd44868eaf9
parent2ded1e7406914eda77abde035416140849d76f68
sparse, llvm: Add support for logical ops

The generated asm for logical-ops.c test case looks as follows on x86-64:

GCC 4.6:

  0000000000000000 <and_bool>:
     0: 31 c0                 xor    %eax,%eax
     2: 85 f6                 test   %esi,%esi
     4: 0f 95 c0              setne  %al
     7: 31 d2                 xor    %edx,%edx
     9: 85 ff                 test   %edi,%edi
     b: 0f 95 c2              setne  %dl
     e: 21 d0                 and    %edx,%eax
    10: c3                    retq

  0000000000000020 <uand_bool>:
    20: 31 c0                 xor    %eax,%eax
    22: 85 f6                 test   %esi,%esi
    24: 0f 95 c0              setne  %al
    27: 31 d2                 xor    %edx,%edx
    29: 85 ff                 test   %edi,%edi
    2b: 0f 95 c2              setne  %dl
    2e: 21 d0                 and    %edx,%eax
    30: c3                    retq

  0000000000000040 <or_bool>:
    40: 09 fe                 or     %edi,%esi
    42: 0f 95 c0              setne  %al
    45: 0f b6 c0              movzbl %al,%eax
    48: c3                    retq

  0000000000000050 <uor_bool>:
    50: 09 fe                 or     %edi,%esi
    52: 0f 95 c0              setne  %al
    55: 0f b6 c0              movzbl %al,%eax
    58: c3                    retq

Sparse/LLVM:

  0000000000000000 <and_bool>:
     0: 85 f6                 test   %esi,%esi
     2: 0f 95 c0              setne  %al
     5: 85 ff                 test   %edi,%edi
     7: 0f 95 c1              setne  %cl
     a: 20 c1                 and    %al,%cl
     c: 0f b6 c1              movzbl %cl,%eax
     f: c3                    retq

  0000000000000010 <uand_bool>:
    10: 85 f6                 test   %esi,%esi
    12: 0f 95 c0              setne  %al
    15: 85 ff                 test   %edi,%edi
    17: 0f 95 c1              setne  %cl
    1a: 20 c1                 and    %al,%cl
    1c: 0f b6 c1              movzbl %cl,%eax
    1f: c3                    retq

  0000000000000020 <or_bool>:
    20: 09 f7                 or     %esi,%edi
    22: 0f 95 c0              setne  %al
    25: 0f b6 c0              movzbl %al,%eax
    28: c3                    retq

  0000000000000030 <uor_bool>:
    30: 09 f7                 or     %esi,%edi
    32: 0f 95 c0              setne  %al
    35: 0f b6 c0              movzbl %al,%eax
    38: c3                    retq

Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
sparse-llvm.c
validation/backend/logical-ops.c