diff --git a/llvm/test/CodeGen/X86/pr41619.ll b/llvm/test/CodeGen/X86/pr41619.ll index 7c71f2c1c29a..13bfd910587c 100644 --- a/llvm/test/CodeGen/X86/pr41619.ll +++ b/llvm/test/CodeGen/X86/pr41619.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc < %s -mtriple=x86_64-apple-macosx10.14.0 -mattr=avx2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-apple-macosx10.14.0 -mattr=avx2 | FileCheck %s --check-prefixes=CHECK,AVX +; RUN: llc < %s -mtriple=x86_64-apple-macosx10.14.0 -mattr=avx512bw | FileCheck %s --check-prefixes=CHECK,AVX512 define void @foo(double %arg) { ; CHECK-LABEL: foo: @@ -25,3 +26,33 @@ bb: store double %tmp5, double* undef, align 16 ret void } + +; This used to crash with mask registers on avx512bw targets. +define i32 @bar(double %blah) nounwind { +; AVX-LABEL: bar: +; AVX: ## %bb.0: +; AVX-NEXT: pushq %rbp +; AVX-NEXT: movq %rsp, %rbp +; AVX-NEXT: andq $-32, %rsp +; AVX-NEXT: subq $32, %rsp +; AVX-NEXT: vmovq %xmm0, %rax +; AVX-NEXT: ## kill: def $eax killed $eax killed $rax +; AVX-NEXT: movq %rbp, %rsp +; AVX-NEXT: popq %rbp +; AVX-NEXT: retq +; +; AVX512-LABEL: bar: +; AVX512: ## %bb.0: +; AVX512-NEXT: vmovq %xmm0, %rax +; AVX512-NEXT: kmovd %eax, %k0 +; AVX512-NEXT: kmovq %k0, %rax +; AVX512-NEXT: ## kill: def $eax killed $eax killed $rax +; AVX512-NEXT: retq + %z = bitcast double %blah to i64 + %y = trunc i64 %z to i32 + %a = bitcast i32 %y to <32 x i1> + %b = shufflevector <32 x i1> %a, <32 x i1> undef, <64 x i32> + %c = bitcast <64 x i1> %b to i64 + %d = trunc i64 %c to i32 + ret i32 %d +}