1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown -mattr=+avx | FileCheck %s --check-prefix=X64
5 ; These tests just check that the plumbing is in place for @llvm.bswap. The
6 ; actual output is massive at the moment as llvm.bswap is not yet legal.
8 declare i32 @llvm.bswap.i32(i32) readnone
9 declare i32 @llvm.bswap.v4i32(i32) readnone
11 ; fold (bswap undef) -> undef
12 define i32 @test_undef() nounwind {
13 ; X86-LABEL: test_undef:
17 ; X64-LABEL: test_undef:
20 %b = call i32 @llvm.bswap.i32(i32 undef)
24 ; fold (bswap (bswap x)) -> x
25 define i32 @test_bswap_bswap(i32 %a0) nounwind {
26 ; X86-LABEL: test_bswap_bswap:
28 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
31 ; X64-LABEL: test_bswap_bswap:
33 ; X64-NEXT: movl %edi, %eax
35 %b = call i32 @llvm.bswap.i32(i32 %a0)
36 %c = call i32 @llvm.bswap.i32(i32 %b)
40 define i32 @test_demandedbits_bswap(i32 %a0) nounwind {
41 ; X86-LABEL: test_demandedbits_bswap:
43 ; X86-NEXT: movl $-16777216, %eax # imm = 0xFF000000
44 ; X86-NEXT: orl {{[0-9]+}}(%esp), %eax
45 ; X86-NEXT: bswapl %eax
46 ; X86-NEXT: andl $-65536, %eax # imm = 0xFFFF0000
49 ; X64-LABEL: test_demandedbits_bswap:
51 ; X64-NEXT: movl %edi, %eax
52 ; X64-NEXT: orl $-16777216, %eax # imm = 0xFF000000
53 ; X64-NEXT: bswapl %eax
54 ; X64-NEXT: andl $-65536, %eax # imm = 0xFFFF0000
56 %b = or i32 %a0, 4278190080
57 %c = call i32 @llvm.bswap.i32(i32 %b)
58 %d = and i32 %c, 4294901760