xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/and-encoding.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Test that the direct object emission selects the and variant with 8 bit
4*9880d681SAndroid Build Coastguard Worker; immediate.
5*9880d681SAndroid Build Coastguard Worker; We used to get this wrong when using direct object emission, but not when
6*9880d681SAndroid Build Coastguard Worker; reading assembly.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-pc-linux"
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @f1() {
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1:
13*9880d681SAndroid Build Coastguard Worker; CHECK: andq    $-32, %rsp              # encoding: [0x48,0x83,0xe4,0xe0]
14*9880d681SAndroid Build Coastguard Worker  %foo = alloca i8, align 32
15*9880d681SAndroid Build Coastguard Worker  ret void
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine void @f2(i16 %x, i1 *%y) {
19*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2:
20*9880d681SAndroid Build Coastguard Worker; CHECK: andl	$1, %edi                # encoding: [0x83,0xe7,0x01]
21*9880d681SAndroid Build Coastguard Worker  %c = trunc i16 %x to i1
22*9880d681SAndroid Build Coastguard Worker  store i1 %c, i1* %y
23*9880d681SAndroid Build Coastguard Worker  ret void
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdefine void @f3(i32 %x, i1 *%y) {
27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3:
28*9880d681SAndroid Build Coastguard Worker; CHECK: andl	$1, %edi                # encoding: [0x83,0xe7,0x01]
29*9880d681SAndroid Build Coastguard Worker  %c = trunc i32 %x to i1
30*9880d681SAndroid Build Coastguard Worker  store i1 %c, i1* %y
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33