• 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:    kmovb %edi, %k0
8; CHECK-NEXT:    knotb %k0, %k0
9; CHECK-NEXT:    kmovb %k0, %eax
10; CHECK-NEXT:    ## kill: %AL<def> %AL<kill> %EAX<kill>
11; CHECK-NEXT:    retq
12  %m0 = bitcast i8 %x to <8 x i1>
13  %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
14  %ret = bitcast <8 x i1> %m1 to i8
15  ret i8 %ret
16}
17
18define void @mask8_mem(i8* %ptr) {
19; CHECK-LABEL: mask8_mem:
20; CHECK:       ## BB#0:
21; CHECK-NEXT:    kmovb (%rdi), %k0
22; CHECK-NEXT:    knotb %k0, %k0
23; CHECK-NEXT:    kmovb %k0, (%rdi)
24; CHECK-NEXT:    retq
25  %x = load i8, i8* %ptr, align 4
26  %m0 = bitcast i8 %x to <8 x i1>
27  %m1 = xor <8 x i1> %m0, <i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1, i1 -1>
28  %ret = bitcast <8 x i1> %m1 to i8
29  store i8 %ret, i8* %ptr, align 4
30  ret void
31}
32
33define i8 @mand8(i8 %x, i8 %y) {
34; CHECK-LABEL: mand8:
35; CHECK:       ## BB#0:
36; CHECK-NEXT:    movl %edi, %eax
37; CHECK-NEXT:    xorl %esi, %eax
38; CHECK-NEXT:    andl %esi, %edi
39; CHECK-NEXT:    orl %eax, %edi
40; CHECK-NEXT:    movl %edi, %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:    kmovb %k0, %eax
60; CHECK-NEXT:    ## kill: %AL<def> %AL<kill> %EAX<kill>
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