File: avx512-cmp-mask.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (134 lines) | stat: -rw-r--r-- 5,975 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512vl | FileCheck %s --check-prefixes=CHECK,AVX512VL
; RUN: llc < %s -mtriple=x86_64-apple-darwin -mattr=+avx512f,+avx512vl,+avx512dq | FileCheck %s --check-prefixes=CHECK,AVX512DQVL

define <4 x i64> @PR32546(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d) {
; AVX512VL-LABEL: PR32546:
; AVX512VL:       ## %bb.0: ## %entry
; AVX512VL-NEXT:    vcmpltps %ymm1, %ymm0, %k0
; AVX512VL-NEXT:    vcmpltps %ymm3, %ymm2, %k1
; AVX512VL-NEXT:    kandw %k0, %k1, %k0
; AVX512VL-NEXT:    kmovw %k0, %eax
; AVX512VL-NEXT:    movzbl %al, %eax
; AVX512VL-NEXT:    vpbroadcastd %eax, %ymm0
; AVX512VL-NEXT:    retq
;
; AVX512DQVL-LABEL: PR32546:
; AVX512DQVL:       ## %bb.0: ## %entry
; AVX512DQVL-NEXT:    vcmpltps %ymm1, %ymm0, %k0
; AVX512DQVL-NEXT:    vcmpltps %ymm3, %ymm2, %k1
; AVX512DQVL-NEXT:    kandb %k0, %k1, %k0
; AVX512DQVL-NEXT:    kmovb %k0, %eax
; AVX512DQVL-NEXT:    vpbroadcastd %eax, %ymm0
; AVX512DQVL-NEXT:    retq
entry:
  %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
  %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
  %and17 = and i8 %1, %0
  %and = zext i8 %and17 to i32
  %2 = insertelement <8 x i32> undef, i32 %and, i32 0
  %vecinit7.i = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32> zeroinitializer
  %3 = bitcast <8 x i32> %vecinit7.i to <4 x i64>
  ret <4 x i64> %3
}

define void @PR32547(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d, ptr %p) {
; CHECK-LABEL: PR32547:
; CHECK:       ## %bb.0: ## %entry
; CHECK-NEXT:    vcmpltps %ymm1, %ymm0, %k0
; CHECK-NEXT:    vcmpltps %ymm3, %ymm2, %k1
; CHECK-NEXT:    kunpckbw %k1, %k0, %k1
; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
; CHECK-NEXT:    vmovaps %zmm0, (%rdi) {%k1}
; CHECK-NEXT:    vzeroupper
; CHECK-NEXT:    retq
 entry:
   %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
   %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
   %conv.i = zext i8 %0 to i16
   %conv.i18 = zext i8 %1 to i16
   %shl = shl nuw i16 %conv.i, 8
   %or = or i16 %shl, %conv.i18
   %2 = bitcast i16 %or to <16 x i1>
   tail call void @llvm.masked.store.v16f32.p0(<16 x float> zeroinitializer, ptr %p, i32 64, <16 x i1> %2)
   ret void
}

define void @PR32547_swap(<8 x float> %a, <8 x float> %b, <8 x float> %c, <8 x float> %d, ptr %p) {
; CHECK-LABEL: PR32547_swap:
; CHECK:       ## %bb.0: ## %entry
; CHECK-NEXT:    vcmpltps %ymm1, %ymm0, %k0
; CHECK-NEXT:    vcmpltps %ymm3, %ymm2, %k1
; CHECK-NEXT:    kunpckbw %k1, %k0, %k1
; CHECK-NEXT:    vxorps %xmm0, %xmm0, %xmm0
; CHECK-NEXT:    vmovaps %zmm0, (%rdi) {%k1}
; CHECK-NEXT:    vzeroupper
; CHECK-NEXT:    retq
 entry:
   %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %a, <8 x float> %b, i32 1, i8 -1)
   %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float> %c, <8 x float> %d, i32 1, i8 -1)
   %conv.i = zext i8 %0 to i16
   %conv.i18 = zext i8 %1 to i16
   %shl = shl nuw i16 %conv.i, 8
   %or = or i16 %conv.i18, %shl
   %2 = bitcast i16 %or to <16 x i1>
   tail call void @llvm.masked.store.v16f32.p0(<16 x float> zeroinitializer, ptr %p, i32 64, <16 x i1> %2)
   ret void
}

define void @mask_cmp_128(<4 x float> %a, <4 x float> %b, <4 x float> %c, <4 x float> %d, ptr %p) {
; AVX512VL-LABEL: mask_cmp_128:
; AVX512VL:       ## %bb.0: ## %entry
; AVX512VL-NEXT:    vcmpltps %xmm1, %xmm0, %k0
; AVX512VL-NEXT:    kmovw %k0, %eax
; AVX512VL-NEXT:    vcmpltps %xmm3, %xmm2, %k0
; AVX512VL-NEXT:    shlb $4, %al
; AVX512VL-NEXT:    kmovw %eax, %k1
; AVX512VL-NEXT:    korw %k1, %k0, %k1
; AVX512VL-NEXT:    vxorps %xmm0, %xmm0, %xmm0
; AVX512VL-NEXT:    vmovaps %ymm0, (%rdi) {%k1}
; AVX512VL-NEXT:    vzeroupper
; AVX512VL-NEXT:    retq
;
; AVX512DQVL-LABEL: mask_cmp_128:
; AVX512DQVL:       ## %bb.0: ## %entry
; AVX512DQVL-NEXT:    vcmpltps %xmm1, %xmm0, %k0
; AVX512DQVL-NEXT:    vcmpltps %xmm3, %xmm2, %k1
; AVX512DQVL-NEXT:    kshiftlb $4, %k0, %k0
; AVX512DQVL-NEXT:    korb %k0, %k1, %k1
; AVX512DQVL-NEXT:    vxorps %xmm0, %xmm0, %xmm0
; AVX512DQVL-NEXT:    vmovaps %ymm0, (%rdi) {%k1}
; AVX512DQVL-NEXT:    vzeroupper
; AVX512DQVL-NEXT:    retq
entry:
  %0 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float> %a, <4 x float> %b, i32 1, i8 -1)
  %1 = tail call i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float> %c, <4 x float> %d, i32 1, i8 -1)
  %shl = shl nuw i8 %0, 4
  %or = or i8 %1, %shl
  %2 = bitcast i8 %or to <8 x i1>
  tail call void @llvm.masked.store.v8f32.p0(<8 x float> zeroinitializer, ptr %p, i32 64, <8 x i1> %2)
  ret void
}

define <16 x float> @mask_cmp_512(<16 x float> %a, <16 x float> %b, <16 x float> %c, <16 x float> %d, ptr %p) {
; CHECK-LABEL: mask_cmp_512:
; CHECK:       ## %bb.0: ## %entry
; CHECK-NEXT:    vcmpltps {sae}, %zmm1, %zmm0, %k0
; CHECK-NEXT:    vcmpltps %zmm3, %zmm2, %k1
; CHECK-NEXT:    kxnorw %k1, %k0, %k1
; CHECK-NEXT:    vmovaps (%rdi), %zmm0 {%k1} {z}
; CHECK-NEXT:    retq
 entry:
   %0 = tail call i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float> %a, <16 x float> %b, i32 1, i16 -1, i32 8)
   %1 = tail call i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float> %c, <16 x float> %d, i32 1, i16 -1, i32 4)
   %2 = load <16 x float>, ptr %p
   %3 = xor i16 %0, %1
   %4 = bitcast i16 %3 to <16 x i1>
   %5 = select <16 x i1> %4, <16 x float> zeroinitializer, <16 x float> %2
   ret <16 x float> %5
}
declare i8 @llvm.x86.avx512.mask.cmp.ps.128(<4 x float>, <4 x float>, i32, i8)
declare i8 @llvm.x86.avx512.mask.cmp.ps.256(<8 x float>, <8 x float>, i32, i8)
declare i16 @llvm.x86.avx512.mask.cmp.ps.512(<16 x float>, <16 x float>, i32, i16, i32)
declare void @llvm.masked.store.v8f32.p0(<8 x float>, ptr, i32, <8 x i1>)
declare void @llvm.masked.store.v16f32.p0(<16 x float>, ptr, i32, <16 x i1>)