llvm/llvm/test/Transforms/TypePromotion/AArch64/bitcast.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -mtriple=aarch64 -passes=typepromotion,verify,dce -S %s -o - | FileCheck %s

target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"

define i1 @v8i8bitcast(<8 x i8> %a) {
; CHECK-LABEL: define i1 @v8i8bitcast
; CHECK-SAME: (<8 x i8> [[A:%.*]]) {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[C:%.*]] = icmp slt <8 x i8> [[A]], zeroinitializer
; CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x i1> [[C]] to i8
; CHECK-NEXT:    [[N:%.*]] = icmp eq i8 [[TMP0]], 0
; CHECK-NEXT:    ret i1 [[N]]
;
entry:
  %c = icmp slt <8 x i8> %a, zeroinitializer
  %0 = bitcast <8 x i1> %c to i8
  %n = icmp eq i8 %0, 0
  ret i1 %n
}

define i1 @halfbitcast() {
; CHECK-LABEL: define i1 @halfbitcast() {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = bitcast half 0xH8000 to i16
; CHECK-NEXT:    [[DOTNOT114:%.*]] = icmp eq i16 [[TMP0]], 0
; CHECK-NEXT:    ret i1 [[DOTNOT114]]
;
entry:
  %0 = bitcast half 0xH8000 to i16
  %.not114 = icmp eq i16 %0, 0
  ret i1 %.not114
}

define i1 @v8i8constant(<8 x i1> %a) {
; CHECK-LABEL: define i1 @v8i8constant
; CHECK-SAME: (<8 x i1> [[A:%.*]]) {
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP0:%.*]] = bitcast <8 x i1> <i1 true, i1 true, i1 true, i1 false, i1 true, i1 true, i1 true, i1 true> to i8
; CHECK-NEXT:    [[DOTNOT114:%.*]] = icmp eq i8 [[TMP0]], 0
; CHECK-NEXT:    ret i1 [[DOTNOT114]]
;
entry:
  %0 = bitcast <8 x i1> <i1 1, i1 1, i1 1, i1 0, i1 1, i1 1, i1 1, i1 1> to i8
  %.not114 = icmp eq i8 %0, 0
  ret i1 %.not114
}