blob: 32a48fbedca29911c67ee202f65347a523323ead [file] [log] [blame]
Bill Wendlingc6df9882011-04-14 01:11:51 +00001; RUN: llc < %s -march=x86-64 | FileCheck %s
Dan Gohmanaf70e5c2009-08-26 14:59:13 +00002
Bill Wendlingc6df9882011-04-14 01:11:51 +00003; Use movzbl (aliased as movzx) to avoid partial-register updates.
Dan Gohmanaf70e5c2009-08-26 14:59:13 +00004
5define i32 @foo(i32 %p, i8 zeroext %x) nounwind {
Bill Wendlingc6df9882011-04-14 01:11:51 +00006; CHECK: movzx %dil, %eax
7; CHECK: movzx %al, %eax
Dan Gohmanaf70e5c2009-08-26 14:59:13 +00008 %q = trunc i32 %p to i8
9 %r = udiv i8 %q, %x
10 %s = zext i8 %r to i32
11 %t = and i32 %s, 1
12 ret i32 %t
13}
14define i32 @bar(i32 %p, i16 zeroext %x) nounwind {
15 %q = trunc i32 %p to i16
16 %r = udiv i16 %q, %x
17 %s = zext i16 %r to i32
18 %t = and i32 %s, 1
19 ret i32 %t
20}