aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/sar_fold.ll
blob: bd0d0c7057d34eac2534a765d899341d6c7cc7b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s

define i32 @shl16sar15(i32 %a) #0 {
; CHECK-LABEL: shl16sar15:
; CHECK:       # BB#0:
; CHECK-NEXT:    movswl {{[0-9]+}}(%esp), %eax
  %1 = shl i32 %a, 16
  %2 = ashr exact i32 %1, 15
  ret i32 %2
}

define i32 @shl16sar17(i32 %a) #0 {
; CHECK-LABEL: shl16sar17:
; CHECK:       # BB#0:
; CHECK-NEXT:    movswl {{[0-9]+}}(%esp), %eax
  %1 = shl i32 %a, 16
  %2 = ashr exact i32 %1, 17
  ret i32 %2
}

define i32 @shl24sar23(i32 %a) #0 {
; CHECK-LABEL: shl24sar23:
; CHECK:       # BB#0:
; CHECK-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
  %1 = shl i32 %a, 24
  %2 = ashr exact i32 %1, 23
  ret i32 %2
}

define i32 @shl24sar25(i32 %a) #0 {
; CHECK-LABEL: shl24sar25:
; CHECK:       # BB#0:
; CHECK-NEXT:    movsbl {{[0-9]+}}(%esp), %eax
  %1 = shl i32 %a, 24
  %2 = ashr exact i32 %1, 25
  ret i32 %2
}