1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes='default<O3>' -S | FileCheck %s
4 ; C++ version of test case
5 ; #include <x86intrin.h>
7 ; bool allones(__m512i x) {
9 ; x[0] == -1 && x[1] == -1 &&
10 ; x[2] == -1 && x[3] == -1 &&
11 ; x[4] == -1 && x[5] == -1 &&
12 ; x[6] == -1 && x[7] == -1;
15 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
16 target triple = "x86_64-unknown-linux-gnu"
18 ; Function Attrs: mustprogress nounwind uwtable
19 define noundef zeroext i1 @allones(<8 x i64> noundef %x) {
20 ; CHECK-LABEL: @allones(
22 ; CHECK-NEXT: [[TMP0:%.*]] = tail call i64 @llvm.vector.reduce.and.v8i64(<8 x i64> [[X:%.*]])
23 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i64 [[TMP0]], -1
24 ; CHECK-NEXT: ret i1 [[TMP1]]
27 %vecext = extractelement <8 x i64> %x, i32 0
28 %cmp = icmp eq i64 %vecext, -1
29 %vecext1 = extractelement <8 x i64> %x, i32 1
30 %cmp2 = icmp eq i64 %vecext1, -1
31 %or.cond = select i1 %cmp, i1 %cmp2, i1 false
32 %vecext4 = extractelement <8 x i64> %x, i32 2
33 %cmp5 = icmp eq i64 %vecext4, -1
34 %or.cond20 = select i1 %or.cond, i1 %cmp5, i1 false
35 %vecext7 = extractelement <8 x i64> %x, i32 3
36 %cmp8 = icmp eq i64 %vecext7, -1
37 %or.cond21 = select i1 %or.cond20, i1 %cmp8, i1 false
38 %vecext10 = extractelement <8 x i64> %x, i32 4
39 %cmp11 = icmp eq i64 %vecext10, -1
40 %or.cond22 = select i1 %or.cond21, i1 %cmp11, i1 false
41 %vecext13 = extractelement <8 x i64> %x, i32 5
42 %cmp14 = icmp eq i64 %vecext13, -1
43 %or.cond23 = select i1 %or.cond22, i1 %cmp14, i1 false
44 %vecext16 = extractelement <8 x i64> %x, i32 6
45 %cmp17 = icmp eq i64 %vecext16, -1
46 %or.cond24 = select i1 %or.cond23, i1 %cmp17, i1 false
47 br i1 %or.cond24, label %land.rhs, label %land.end
49 land.rhs: ; preds = %entry
50 %vecext18 = extractelement <8 x i64> %x, i32 7
52 %cmp19 = icmp eq i64 %vecext18, -1
55 land.end: ; preds = %land.rhs, %entry
56 %0 = phi i1 [ false, %entry ], [ %cmp19, %land.rhs ]