From 06ae0253456f932ae20493f332ca1f4c7974501c Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 11 Mar 2019 18:08:20 +0000 Subject: [PATCH] [X86] Extend widening comparison test. Ensure we test both v2i16 unary and binary comparisons. llvm-svn: 355849 --- llvm/test/CodeGen/X86/widen_compare-1.ll | 33 +++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/llvm/test/CodeGen/X86/widen_compare-1.ll b/llvm/test/CodeGen/X86/widen_compare-1.ll index 9c0fb0e..8e20057 100644 --- a/llvm/test/CodeGen/X86/widen_compare-1.ll +++ b/llvm/test/CodeGen/X86/widen_compare-1.ll @@ -4,13 +4,13 @@ ; compare v2i16 -define <2 x i16> @compare_v2i64_to_v2i16(<2 x i16>* %src) nounwind { -; X86-LABEL: compare_v2i64_to_v2i16: +define <2 x i16> @compare_v2i64_to_v2i16_unary(<2 x i16>* %src) nounwind { +; X86-LABEL: compare_v2i64_to_v2i16_unary: ; X86: # %bb.0: ; X86-NEXT: pcmpeqd %xmm0, %xmm0 ; X86-NEXT: retl ; -; X64-LABEL: compare_v2i64_to_v2i16: +; X64-LABEL: compare_v2i64_to_v2i16_unary: ; X64: # %bb.0: ; X64-NEXT: pcmpeqd %xmm0, %xmm0 ; X64-NEXT: retq @@ -19,3 +19,30 @@ define <2 x i16> @compare_v2i64_to_v2i16(<2 x i16>* %src) nounwind { %sel = select <2 x i1> %cmp, <2 x i16> , <2 x i16> zeroinitializer ret <2 x i16> %sel } + +define <2 x i16> @compare_v2i64_to_v2i16_binary(<2 x i16>* %src0, <2 x i16>* %src1) nounwind { +; X86-LABEL: compare_v2i64_to_v2i16_binary: +; X86: # %bb.0: +; X86-NEXT: movl {{[0-9]+}}(%esp), %eax +; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X86-NEXT: pmovzxwq {{.*#+}} xmm0 = mem[0],zero,zero,zero,mem[1],zero,zero,zero +; X86-NEXT: pmovzxwq {{.*#+}} xmm1 = mem[0],zero,zero,zero,mem[1],zero,zero,zero +; X86-NEXT: pcmpgtq %xmm0, %xmm1 +; X86-NEXT: pcmpeqd %xmm0, %xmm0 +; X86-NEXT: pxor %xmm1, %xmm0 +; X86-NEXT: retl +; +; X64-LABEL: compare_v2i64_to_v2i16_binary: +; X64: # %bb.0: +; X64-NEXT: pmovzxwq {{.*#+}} xmm0 = mem[0],zero,zero,zero,mem[1],zero,zero,zero +; X64-NEXT: pmovzxwq {{.*#+}} xmm1 = mem[0],zero,zero,zero,mem[1],zero,zero,zero +; X64-NEXT: pcmpgtq %xmm0, %xmm1 +; X64-NEXT: pcmpeqd %xmm0, %xmm0 +; X64-NEXT: pxor %xmm1, %xmm0 +; X64-NEXT: retq + %val0 = load <2 x i16>, <2 x i16>* %src0, align 4 + %val1 = load <2 x i16>, <2 x i16>* %src1, align 4 + %cmp = icmp uge <2 x i16> %val0, %val1 + %sel = select <2 x i1> %cmp, <2 x i16> , <2 x i16> zeroinitializer + ret <2 x i16> %sel +} -- 2.7.4