[llvm] r347316 - [AArch64, x86] add tests for shift-not (PR39657); NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 20 07:49:42 PST 2018
Author: spatel
Date: Tue Nov 20 07:49:42 2018
New Revision: 347316
URL: http://llvm.org/viewvc/llvm-project?rev=347316&view=rev
Log:
[AArch64, x86] add tests for shift-not (PR39657); NFC
Added:
llvm/trunk/test/CodeGen/AArch64/xor.ll
Modified:
llvm/trunk/test/CodeGen/X86/xor.ll
Added: llvm/trunk/test/CodeGen/AArch64/xor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/xor.ll?rev=347316&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/xor.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/xor.ll Tue Nov 20 07:49:42 2018
@@ -0,0 +1,18 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
+
+define i32 @PR39657(i8* %p, i64 %x) {
+; CHECK-LABEL: PR39657:
+; CHECK: // %bb.0:
+; CHECK-NEXT: lsl x8, x1, #2
+; CHECK-NEXT: eor x8, x8, #0xfffffffffffffffc
+; CHECK-NEXT: ldr w0, [x0, x8]
+; CHECK-NEXT: ret
+ %sh = shl i64 %x, 2
+ %mul = xor i64 %sh, -4
+ %add.ptr = getelementptr inbounds i8, i8* %p, i64 %mul
+ %bc = bitcast i8* %add.ptr to i32*
+ %load = load i32, i32* %bc, align 4
+ ret i32 %load
+}
+
Modified: llvm/trunk/test/CodeGen/X86/xor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xor.ll?rev=347316&r1=347315&r2=347316&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xor.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xor.ll Tue Nov 20 07:49:42 2018
@@ -512,3 +512,35 @@ define %struct.ref_s* @test12(%struct.re
%add.ptr = getelementptr inbounds %struct.ref_s, %struct.ref_s* %op, i64 %idx.ext
ret %struct.ref_s* %add.ptr
}
+
+define i32 @PR39657(i8* %p, i64 %x) {
+; X32-LABEL: PR39657:
+; X32: # %bb.0:
+; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X32-NEXT: shll $2, %ecx
+; X32-NEXT: xorl $-4, %ecx
+; X32-NEXT: movl (%eax,%ecx), %eax
+; X32-NEXT: retl
+;
+; X64-LIN-LABEL: PR39657:
+; X64-LIN: # %bb.0:
+; X64-LIN-NEXT: shlq $2, %rsi
+; X64-LIN-NEXT: xorq $-4, %rsi
+; X64-LIN-NEXT: movl (%rdi,%rsi), %eax
+; X64-LIN-NEXT: retq
+;
+; X64-WIN-LABEL: PR39657:
+; X64-WIN: # %bb.0:
+; X64-WIN-NEXT: shlq $2, %rdx
+; X64-WIN-NEXT: xorq $-4, %rdx
+; X64-WIN-NEXT: movl (%rcx,%rdx), %eax
+; X64-WIN-NEXT: retq
+ %sh = shl i64 %x, 2
+ %mul = xor i64 %sh, -4
+ %add.ptr = getelementptr inbounds i8, i8* %p, i64 %mul
+ %bc = bitcast i8* %add.ptr to i32*
+ %load = load i32, i32* %bc, align 4
+ ret i32 %load
+}
+
More information about the llvm-commits
mailing list