https://github.com/heiher updated https://github.com/llvm/llvm-project/pull/117105
>From 016267af967b8ff83d8ae2a98e1aeea8a5572f77 Mon Sep 17 00:00:00 2001 From: Zhaoxin Yang <yangzhao...@loongson.cn> Date: Mon, 11 Nov 2024 16:46:22 +0800 Subject: [PATCH 1/2] [MC][LoongArch] Change default cpu in `MCSubtargetInfo`. (#114922) The default value of this CPU affects the `FeatureBits` obtained by `LoongArchTargetELFStreamer` when creating an ELF file, and it will further affect the `Flags` field in the generated file. So, the default CPU value should be consistent with the `initializeSubtargetDependencies` in `LoongArchSubtarget.cpp`. Otherwise, the `Flags` field may be unexpected. (cherry picked from commit 75c2888209473884cb3fa5720899d8199dafb8cb) --- .../Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp | 2 +- llvm/test/CodeGen/LoongArch/e_flags.ll | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp index e40981f5b5cd57..0712cc01ea0386 100644 --- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp +++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp @@ -55,7 +55,7 @@ static MCInstrInfo *createLoongArchMCInstrInfo() { static MCSubtargetInfo * createLoongArchMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) { if (CPU.empty() || CPU == "generic") - CPU = TT.isArch64Bit() ? "la464" : "generic-la32"; + CPU = TT.isArch64Bit() ? "generic-la64" : "generic-la32"; return createLoongArchMCSubtargetInfoImpl(TT, CPU, /*TuneCPU*/ CPU, FS); } diff --git a/llvm/test/CodeGen/LoongArch/e_flags.ll b/llvm/test/CodeGen/LoongArch/e_flags.ll index 2feb9d832bca9a..5d2aa9695b21ae 100644 --- a/llvm/test/CodeGen/LoongArch/e_flags.ll +++ b/llvm/test/CodeGen/LoongArch/e_flags.ll @@ -1,3 +1,6 @@ +; RUN: llc --mtriple=loongarch32 --filetype=obj %s -o %t-la32s +; RUN: llvm-readelf -h %t-la32s | FileCheck %s --check-prefixes=ILP32,ABI-S --match-full-lines + ; RUN: llc --mtriple=loongarch32 -mattr=+d --filetype=obj %s -o %t-la32 ; RUN: llvm-readelf -h %t-la32 | FileCheck %s --check-prefixes=ILP32,ABI-D --match-full-lines @@ -10,6 +13,9 @@ ; RUN: llc --mtriple=loongarch32 -mattr=+d --filetype=obj %s --target-abi=ilp32d -o %t-ilp32d ; RUN: llvm-readelf -h %t-ilp32d | FileCheck %s --check-prefixes=ILP32,ABI-D --match-full-lines +; RUN: llc --mtriple=loongarch64 --filetype=obj %s -o %t-la64d +; RUN: llvm-readelf -h %t-la64d | FileCheck %s --check-prefixes=LP64,ABI-D --match-full-lines + ; RUN: llc --mtriple=loongarch64 -mattr=+d --filetype=obj %s -o %t-la64 ; RUN: llvm-readelf -h %t-la64 | FileCheck %s --check-prefixes=LP64,ABI-D --match-full-lines >From d5829ee6c2f3491c2b213fe3fc4bd4970958e818 Mon Sep 17 00:00:00 2001 From: WANG Rui <wang...@loongson.cn> Date: Thu, 21 Nov 2024 15:21:37 +0800 Subject: [PATCH 2/2] Address test case failures --- lld/test/ELF/emulation-loongarch.s | 2 +- lld/test/ELF/loongarch-interlink.test | 4 ++-- llvm/test/CodeGen/LoongArch/e_flags.ll | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lld/test/ELF/emulation-loongarch.s b/lld/test/ELF/emulation-loongarch.s index 28b879f7584689..cfa8df4d8e2fe1 100644 --- a/lld/test/ELF/emulation-loongarch.s +++ b/lld/test/ELF/emulation-loongarch.s @@ -37,7 +37,7 @@ # LA32-NEXT: StringTableSectionIndex: # LA32-NEXT: } -# RUN: llvm-mc -filetype=obj -triple=loongarch64 %s -o %t.o +# RUN: llvm-mc -filetype=obj -triple=loongarch64 -mattr=+d %s -o %t.o # RUN: ld.lld %t.o -o %t # RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=LA64 %s # RUN: ld.lld -m elf64loongarch %t.o -o %t diff --git a/lld/test/ELF/loongarch-interlink.test b/lld/test/ELF/loongarch-interlink.test index 44e5d03409a47c..15c83185126602 100644 --- a/lld/test/ELF/loongarch-interlink.test +++ b/lld/test/ELF/loongarch-interlink.test @@ -3,9 +3,9 @@ # RUN: yaml2obj %t/blob.yaml -o %t/blob.o # RUN: yaml2obj %t/v0-lp64d.yaml -o %t/v0-lp64d.o -# RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-gnu %t/start.s -o %t/v1-lp64d.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-gnu --mattr=+d %t/start.s -o %t/v1-lp64d.o # RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-gnusf %t/start.s -o %t/v1-lp64s.o -# RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-gnu %t/bar.s -o %t/v1-b-lp64d.o +# RUN: llvm-mc --filetype=obj --triple=loongarch64-unknown-gnu --mattr=+d %t/bar.s -o %t/v1-b-lp64d.o ## Check that binary input results in e_flags=0 output. # RUN: ld.lld -m elf64loongarch -b binary %t/blob.bin -o %t/blob.out diff --git a/llvm/test/CodeGen/LoongArch/e_flags.ll b/llvm/test/CodeGen/LoongArch/e_flags.ll index 5d2aa9695b21ae..9b2dc87eb353d0 100644 --- a/llvm/test/CodeGen/LoongArch/e_flags.ll +++ b/llvm/test/CodeGen/LoongArch/e_flags.ll @@ -13,7 +13,7 @@ ; RUN: llc --mtriple=loongarch32 -mattr=+d --filetype=obj %s --target-abi=ilp32d -o %t-ilp32d ; RUN: llvm-readelf -h %t-ilp32d | FileCheck %s --check-prefixes=ILP32,ABI-D --match-full-lines -; RUN: llc --mtriple=loongarch64 --filetype=obj %s -o %t-la64d +; RUN: llc --mtriple=loongarch64 -mattr=+d --filetype=obj %s -o %t-la64d ; RUN: llvm-readelf -h %t-la64d | FileCheck %s --check-prefixes=LP64,ABI-D --match-full-lines ; RUN: llc --mtriple=loongarch64 -mattr=+d --filetype=obj %s -o %t-la64 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits