• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=skx | FileCheck %s
3
4define i8 @mask8(i8 %x) {
5; CHECK-LABEL: mask8:
6; CHECK:       ## %bb.0:
7; CHECK-NEXT:    movl %edi, %eax
8; CHECK-NEXT:    notb %al
9; CHECK-NEXT:    ## kill: def $al killed $al killed $eax
10; CHECK-NEXT:    retq
11  %m0 = bitcast i8 %x to <8 x i1>
12  %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
13  %ret = bitcast <8 x i1> %m1 to i8
14  ret i8 %ret
15}
16
17define void @mask8_mem(i8* %ptr) {
18; CHECK-LABEL: mask8_mem:
19; CHECK:       ## %bb.0:
20; CHECK-NEXT:    kmovb (%rdi), %k0
21; CHECK-NEXT:    knotb %k0, %k0
22; CHECK-NEXT:    kmovb %k0, (%rdi)
23; CHECK-NEXT:    retq
24  %x = load i8, i8* %ptr, align 4
25  %m0 = bitcast i8 %x to <8 x i1>
26  %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
27  %ret = bitcast <8 x i1> %m1 to i8
28  store i8 %ret, i8* %ptr, align 4
29  ret void
30}
31
32define i8 @mand8(i8 %x, i8 %y) {
33; CHECK-LABEL: mand8:
34; CHECK:       ## %bb.0:
35; CHECK-NEXT:    movl %edi, %eax
36; CHECK-NEXT:    movl %eax, %ecx
37; CHECK-NEXT:    andb %sil, %cl
38; CHECK-NEXT:    xorb %sil, %al
39; CHECK-NEXT:    orb %cl, %al
40; CHECK-NEXT:    ## kill: def $al killed $al killed $eax
41; CHECK-NEXT:    retq
42  %ma = bitcast i8 %x to <8 x i1>
43  %mb = bitcast i8 %y to <8 x i1>
44  %mc = and <8 x i1> %ma, %mb
45  %md = xor <8 x i1> %ma, %mb
46  %me = or <8 x i1> %mc, %md
47  %ret = bitcast <8 x i1> %me to i8
48  ret i8 %ret
49}
50
51define i8 @mand8_mem(<8 x i1>* %x, <8 x i1>* %y) {
52; CHECK-LABEL: mand8_mem:
53; CHECK:       ## %bb.0:
54; CHECK-NEXT:    kmovb (%rdi), %k0
55; CHECK-NEXT:    kmovb (%rsi), %k1
56; CHECK-NEXT:    kandb %k1, %k0, %k2
57; CHECK-NEXT:    kxorb %k1, %k0, %k0
58; CHECK-NEXT:    korb %k0, %k2, %k0
59; CHECK-NEXT:    kmovd %k0, %eax
60; CHECK-NEXT:    ## kill: def $al killed $al killed $eax
61; CHECK-NEXT:    retq
62  %ma = load <8 x i1>, <8 x i1>* %x
63  %mb = load <8 x i1>, <8 x i1>* %y
64  %mc = and <8 x i1> %ma, %mb
65  %md = xor <8 x i1> %ma, %mb
66  %me = or <8 x i1> %mc, %md
67  %ret = bitcast <8 x i1> %me to i8
68  ret i8 %ret
69}
70