• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s --check-prefix=X64
4
5; Use movzbl to avoid partial-register updates.
6
7define i32 @foo(i32 %p, i8 zeroext %x) nounwind {
8; X32-LABEL: foo:
9; X32:       # %bb.0:
10; X32-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
11; X32-NEXT:    # kill: def $eax killed $eax def $ax
12; X32-NEXT:    divb {{[0-9]+}}(%esp)
13; X32-NEXT:    movzbl %al, %eax
14; X32-NEXT:    andl $1, %eax
15; X32-NEXT:    retl
16;
17; X64-LABEL: foo:
18; X64:       # %bb.0:
19; X64-NEXT:    movzbl %dil, %eax
20; X64-NEXT:    # kill: def $eax killed $eax def $ax
21; X64-NEXT:    divb %sil
22; X64-NEXT:    movzbl %al, %eax
23; X64-NEXT:    andl $1, %eax
24; X64-NEXT:    retq
25  %q = trunc i32 %p to i8
26  %r = udiv i8 %q, %x
27  %s = zext i8 %r to i32
28  %t = and i32 %s, 1
29  ret i32 %t
30}
31
32define i32 @bar(i32 %p, i16 zeroext %x) nounwind {
33; X32-LABEL: bar:
34; X32:       # %bb.0:
35; X32-NEXT:    movzwl {{[0-9]+}}(%esp), %eax
36; X32-NEXT:    xorl %edx, %edx
37; X32-NEXT:    divw {{[0-9]+}}(%esp)
38; X32-NEXT:    # kill: def $ax killed $ax def $eax
39; X32-NEXT:    andl $1, %eax
40; X32-NEXT:    retl
41;
42; X64-LABEL: bar:
43; X64:       # %bb.0:
44; X64-NEXT:    xorl %edx, %edx
45; X64-NEXT:    movl %edi, %eax
46; X64-NEXT:    divw %si
47; X64-NEXT:    # kill: def $ax killed $ax def $eax
48; X64-NEXT:    andl $1, %eax
49; X64-NEXT:    retq
50  %q = trunc i32 %p to i16
51  %r = udiv i16 %q, %x
52  %s = zext i16 %r to i32
53  %t = and i32 %s, 1
54  ret i32 %t
55}
56