xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/movbe.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-linux -mcpu=atom < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-linux -mcpu=slm < %s | FileCheck %s -check-prefix=SLM
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workerdeclare i16 @llvm.bswap.i16(i16) nounwind readnone
5*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.bswap.i32(i32) nounwind readnone
6*9880d681SAndroid Build Coastguard Workerdeclare i64 @llvm.bswap.i64(i64) nounwind readnone
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine void @test1(i16* nocapture %x, i16 %y) nounwind {
9*9880d681SAndroid Build Coastguard Worker  %bswap = call i16 @llvm.bswap.i16(i16 %y)
10*9880d681SAndroid Build Coastguard Worker  store i16 %bswap, i16* %x, align 2
11*9880d681SAndroid Build Coastguard Worker  ret void
12*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1:
13*9880d681SAndroid Build Coastguard Worker; CHECK: movbew %si, (%rdi)
14*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test1:
15*9880d681SAndroid Build Coastguard Worker; SLM: movbew   %si, (%rdi)
16*9880d681SAndroid Build Coastguard Worker}
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine i16 @test2(i16* %x) nounwind {
19*9880d681SAndroid Build Coastguard Worker  %load = load i16, i16* %x, align 2
20*9880d681SAndroid Build Coastguard Worker  %bswap = call i16 @llvm.bswap.i16(i16 %load)
21*9880d681SAndroid Build Coastguard Worker  ret i16 %bswap
22*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test2:
23*9880d681SAndroid Build Coastguard Worker; CHECK: movbew (%rdi), %ax
24*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test2:
25*9880d681SAndroid Build Coastguard Worker; SLM: movbew   (%rdi), %ax
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdefine void @test3(i32* nocapture %x, i32 %y) nounwind {
29*9880d681SAndroid Build Coastguard Worker  %bswap = call i32 @llvm.bswap.i32(i32 %y)
30*9880d681SAndroid Build Coastguard Worker  store i32 %bswap, i32* %x, align 4
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test3:
33*9880d681SAndroid Build Coastguard Worker; CHECK: movbel	%esi, (%rdi)
34*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test3:
35*9880d681SAndroid Build Coastguard Worker; SLM: movbel	%esi, (%rdi)
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdefine i32 @test4(i32* %x) nounwind {
39*9880d681SAndroid Build Coastguard Worker  %load = load i32, i32* %x, align 4
40*9880d681SAndroid Build Coastguard Worker  %bswap = call i32 @llvm.bswap.i32(i32 %load)
41*9880d681SAndroid Build Coastguard Worker  ret i32 %bswap
42*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test4:
43*9880d681SAndroid Build Coastguard Worker; CHECK: movbel	(%rdi), %eax
44*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test4:
45*9880d681SAndroid Build Coastguard Worker; SLM: movbel	(%rdi), %eax
46*9880d681SAndroid Build Coastguard Worker}
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workerdefine void @test5(i64* %x, i64 %y) nounwind {
49*9880d681SAndroid Build Coastguard Worker  %bswap = call i64 @llvm.bswap.i64(i64 %y)
50*9880d681SAndroid Build Coastguard Worker  store i64 %bswap, i64* %x, align 8
51*9880d681SAndroid Build Coastguard Worker  ret void
52*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test5:
53*9880d681SAndroid Build Coastguard Worker; CHECK: movbeq	%rsi, (%rdi)
54*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test5:
55*9880d681SAndroid Build Coastguard Worker; SLM: movbeq	%rsi, (%rdi)
56*9880d681SAndroid Build Coastguard Worker}
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Workerdefine i64 @test6(i64* %x) nounwind {
59*9880d681SAndroid Build Coastguard Worker  %load = load i64, i64* %x, align 8
60*9880d681SAndroid Build Coastguard Worker  %bswap = call i64 @llvm.bswap.i64(i64 %load)
61*9880d681SAndroid Build Coastguard Worker  ret i64 %bswap
62*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test6:
63*9880d681SAndroid Build Coastguard Worker; CHECK: movbeq	(%rdi), %rax
64*9880d681SAndroid Build Coastguard Worker; SLM-LABEL: test6:
65*9880d681SAndroid Build Coastguard Worker; SLM: movbeq	(%rdi), %rax
66*9880d681SAndroid Build Coastguard Worker}
67