1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" 4*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-darwin8" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; This should be a single mov, not a load of immediate + andq. 7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test: 8*9880d681SAndroid Build Coastguard Worker; CHECK: movl %edi, %eax 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Workerdefine i64 @test(i64 %x) nounwind { 11*9880d681SAndroid Build Coastguard Workerentry: 12*9880d681SAndroid Build Coastguard Worker %tmp123 = and i64 %x, 4294967295 ; <i64> [#uses=1] 13*9880d681SAndroid Build Coastguard Worker ret i64 %tmp123 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Worker; This copy can't be coalesced away because it needs the implicit zero-extend. 17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: bbb: 18*9880d681SAndroid Build Coastguard Worker; CHECK: movl %edi, %edi 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdefine void @bbb(i64 %x) nounwind { 21*9880d681SAndroid Build Coastguard Worker %t = and i64 %x, 4294967295 22*9880d681SAndroid Build Coastguard Worker call void @foo(i64 %t) 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker} 25*9880d681SAndroid Build Coastguard Worker 26*9880d681SAndroid Build Coastguard Worker; This should use a 32-bit and with implicit zero-extension, not a 64-bit and 27*9880d681SAndroid Build Coastguard Worker; with a separate mov to materialize the mask. 28*9880d681SAndroid Build Coastguard Worker; rdar://7527390 29*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: ccc: 30*9880d681SAndroid Build Coastguard Worker; CHECK: andl $-1048593, %edi 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerdeclare void @foo(i64 %x) nounwind 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard Workerdefine void @ccc(i64 %x) nounwind { 35*9880d681SAndroid Build Coastguard Worker %t = and i64 %x, 4293918703 36*9880d681SAndroid Build Coastguard Worker call void @foo(i64 %t) 37*9880d681SAndroid Build Coastguard Worker ret void 38*9880d681SAndroid Build Coastguard Worker} 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker; This requires a mov and a 64-bit and. 41*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: ddd: 42*9880d681SAndroid Build Coastguard Worker; CHECK: movabsq $4294967296, %r 43*9880d681SAndroid Build Coastguard Worker; CHECK: andq %r{{..}}, %r{{..}} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerdefine void @ddd(i64 %x) nounwind { 46*9880d681SAndroid Build Coastguard Worker %t = and i64 %x, 4294967296 47*9880d681SAndroid Build Coastguard Worker call void @foo(i64 %t) 48*9880d681SAndroid Build Coastguard Worker ret void 49*9880d681SAndroid Build Coastguard Worker} 50