]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGen/X86/rotate2.ll
Vendor import of llvm trunk r338150:
[FreeBSD/FreeBSD.git] / test / CodeGen / X86 / rotate2.ll
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefixes=X64
4
5 define i64 @test1(i64 %x) nounwind  {
6 ; X86-LABEL: test1:
7 ; X86:       # %bb.0: # %entry
8 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
9 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
10 ; X86-NEXT:    movl %ecx, %edx
11 ; X86-NEXT:    shldl $9, %eax, %edx
12 ; X86-NEXT:    shldl $9, %ecx, %eax
13 ; X86-NEXT:    retl
14 ;
15 ; X64-LABEL: test1:
16 ; X64:       # %bb.0: # %entry
17 ; X64-NEXT:    rolq $9, %rdi
18 ; X64-NEXT:    movq %rdi, %rax
19 ; X64-NEXT:    retq
20 entry:
21         %tmp2 = lshr i64 %x, 55         ; <i64> [#uses=1]
22         %tmp4 = shl i64 %x, 9           ; <i64> [#uses=1]
23         %tmp5 = or i64 %tmp2, %tmp4             ; <i64> [#uses=1]
24         ret i64 %tmp5
25 }
26
27 define i64 @test2(i32 %x) nounwind  {
28 ; X86-LABEL: test2:
29 ; X86:       # %bb.0: # %entry
30 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
31 ; X86-NEXT:    roll $10, %eax
32 ; X86-NEXT:    xorl %edx, %edx
33 ; X86-NEXT:    retl
34 ;
35 ; X64-LABEL: test2:
36 ; X64:       # %bb.0: # %entry
37 ; X64-NEXT:    # kill: def $edi killed $edi def $rdi
38 ; X64-NEXT:    roll $10, %edi
39 ; X64-NEXT:    movq %rdi, %rax
40 ; X64-NEXT:    retq
41 entry:
42         %tmp2 = lshr i32 %x, 22         ; <i32> [#uses=1]
43         %tmp4 = shl i32 %x, 10          ; <i32> [#uses=1]
44         %tmp5 = or i32 %tmp2, %tmp4             ; <i32> [#uses=1]
45         %tmp56 = zext i32 %tmp5 to i64          ; <i64> [#uses=1]
46         ret i64 %tmp56
47 }
48