1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -O3 -S < %s | FileCheck %s --check-prefixes=ANY,OLDPM
3 ; RUN: opt -passes='default<O3>' -S < %s | FileCheck %s --check-prefixes=ANY,NEWPM
5 ; This should become a single funnel shift through a combination
6 ; of aggressive-instcombine, simplifycfg, and instcombine.
7 ; https://bugs.llvm.org/show_bug.cgi?id=34924
8 ; These are equivalent, but the value name with the new-pm shows a bug -
9 ; this code should not have been converted to a speculative select with
10 ; an intermediate transform.
12 define i32 @rotl(i32 %a, i32 %b) {
15 ; OLDPM-NEXT: [[TMP0:%.*]] = tail call i32 @llvm.fshl.i32(i32 [[A:%.*]], i32 [[A]], i32 [[B:%.*]])
16 ; OLDPM-NEXT: ret i32 [[TMP0]]
20 ; NEWPM-NEXT: [[SPEC_SELECT:%.*]] = tail call i32 @llvm.fshl.i32(i32 [[A:%.*]], i32 [[A]], i32 [[B:%.*]])
21 ; NEWPM-NEXT: ret i32 [[SPEC_SELECT]]
24 %cmp = icmp eq i32 %b, 0
25 br i1 %cmp, label %end, label %rotbb
29 %shr = lshr i32 %a, %sub
31 %or = or i32 %shr, %shl
35 %cond = phi i32 [ %or, %rotbb ], [ %a, %entry ]