Skip to content

Commit f869576

Browse files
actinksmahesh-attarde
authored andcommitted
Precommit test for PR llvm#172046 (llvm#172127)
1 parent f4002c1 commit f869576

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

llvm/test/CodeGen/X86/pr172046.ll

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2+
; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=X86
3+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=X64
4+
5+
define i32 @shl_nuw_zext(i16 zeroext %x) {
6+
; X86-LABEL: shl_nuw_zext:
7+
; X86: # %bb.0:
8+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
9+
; X86-NEXT: shll $3, %eax
10+
; X86-NEXT: movzwl %ax, %eax
11+
; X86-NEXT: retl
12+
;
13+
; X64-LABEL: shl_nuw_zext:
14+
; X64: # %bb.0:
15+
; X64-NEXT: shll $3, %edi
16+
; X64-NEXT: movzwl %di, %eax
17+
; X64-NEXT: retq
18+
%shl = shl nuw i16 %x, 3
19+
%zext = zext i16 %shl to i32
20+
ret i32 %zext
21+
}
22+
23+
define i32 @shl_nsw_zext(i16 %x) {
24+
; X86-LABEL: shl_nsw_zext:
25+
; X86: # %bb.0:
26+
; X86-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
27+
; X86-NEXT: movl $256, %eax # imm = 0x100
28+
; X86-NEXT: shll %cl, %eax
29+
; X86-NEXT: movzwl %ax, %eax
30+
; X86-NEXT: retl
31+
;
32+
; X64-LABEL: shl_nsw_zext:
33+
; X64: # %bb.0:
34+
; X64-NEXT: movl %edi, %ecx
35+
; X64-NEXT: movl $256, %eax # imm = 0x100
36+
; X64-NEXT: # kill: def $cl killed $cl killed $ecx
37+
; X64-NEXT: shll %cl, %eax
38+
; X64-NEXT: movzwl %ax, %eax
39+
; X64-NEXT: retq
40+
%shl = shl nsw i16 256, %x
41+
%sext = sext i16 %shl to i32
42+
ret i32 %sext
43+
}

0 commit comments

Comments
 (0)