2016-03-26 02:02:14 +08:00
|
|
|
; NOTE: Assertions have been autogenerated by update_test_checks.py
|
|
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
2008-05-07 08:35:55 +08:00
|
|
|
|
|
|
|
define i32 @foo(i32 %x, i32 %y) {
|
2016-03-26 02:02:14 +08:00
|
|
|
; CHECK-LABEL: @foo(
|
2016-04-06 01:24:54 +08:00
|
|
|
; CHECK-NEXT: [[A:%.*]] = and i32 %x, 7
|
2016-03-26 02:02:14 +08:00
|
|
|
; CHECK-NEXT: [[B:%.*]] = and i32 %y, 7
|
|
|
|
; CHECK-NEXT: [[C:%.*]] = mul nuw nsw i32 [[A]], [[B]]
|
|
|
|
; CHECK-NEXT: [[D:%.*]] = shl nuw i32 [[C]], 26
|
|
|
|
; CHECK-NEXT: [[E:%.*]] = ashr exact i32 [[D]], 26
|
|
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
|
|
;
|
2008-05-07 08:35:55 +08:00
|
|
|
%a = and i32 %x, 7
|
|
|
|
%b = and i32 %y, 7
|
|
|
|
%c = mul i32 %a, %b
|
|
|
|
%d = shl i32 %c, 26
|
|
|
|
%e = ashr i32 %d, 26
|
|
|
|
ret i32 %e
|
|
|
|
}
|