[clang] [clang][LoongArch] Add FreeBSD targets (PR #119191)

2024-12-12 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: > > Also a `[Clang]` tag could be prepended to the PR title to make it clearer > > what part gets changed. > > Not only clang, all of FreeBSD on LoongArch It's not about *what can get built after the change*, but *what part of LLVM project this change applies to*, which is Clang.

[clang] [LoongArch] Add FreeBSD targets (PR #119191)

2024-12-11 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: Also a `[Clang]` tag could be prepended to the PR title to make it clearer what part gets changed. https://github.com/llvm/llvm-project/pull/119191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mai

[clang] [LoongArch] Add FreeBSD targets (PR #119191)

2024-12-11 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n approved this pull request. https://github.com/llvm/llvm-project/pull/119191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [LoongArch] Add FreeBSD targets (PR #119191)

2024-12-11 Thread WÁNG Xuěruì via cfe-commits
@@ -223,6 +231,12 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("--no-relax"); } + if (Triple.isLoongArch64()) { +CmdArgs.push_back("-X"); +if (Args.hasArg(options::OPT_mno_relax)) + CmdArgs.push_back("--no-

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
@@ -5743,6 +5747,14 @@ LoongArchTargetLowering::shouldExpandAtomicRMWInIR(AtomicRMWInst *AI) const { } unsigned Size = AI->getType()->getPrimitiveSizeInBits(); + if (Subtarget.hasLAMCAS()) { +if (AI->getOperation() == AtomicRMWInst::Nand || +(Size < 32 /*&& (

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: Also please split the LLVM and Clang changes. https://github.com/llvm/llvm-project/pull/114189 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n commented: I think this is getting more convoluted than necessary? For example, I didn't see a `setOperationAction(ISD::ATOMIC_CMP_SWAP, Legal)` call gated on presence of the `lamcas` feature, which I think would render a lot (if not most) of the changes here made to t

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
@@ -363,6 +363,10 @@ LoongArchTargetLowering::LoongArchTargetLowering(const TargetMachine &TM, setPrefFunctionAlignment(Subtarget.getPrefFunctionAlignment()); setPrefLoopAlignment(Subtarget.getPrefLoopAlignment()); setMaxBytesForAlignment(Subtarget.getMaxBytesForAlignmen

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
@@ -1562,7 +1562,9 @@ unsigned LoongArchAsmParser::checkTargetMatchPredicate(MCInst &Inst) { unsigned Opc = Inst.getOpcode(); switch (Opc) { default: -if (Opc >= LoongArch::AMADD_D && Opc <= LoongArch::AMXOR_W) { +// amcas[_db].{b/h/w/d} didn't need this judgemen

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
@@ -0,0 +1,30 @@ +/// Test -m[no]lamcas options. + +// RUN: %clang --target=loongarch64 -mlamcas -fsyntax-only %s -### 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CC1-LAMCAS +// RUN: %clang --target=loongarch64 -mno-lamcas -fsyntax-only %s -### 2>&1 | \ +// RUN: FileChec

[clang] [llvm] [LoongArch] Support amcas[_db].{b/h/w/d} instructions. (PR #114189)

2024-10-31 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/114189 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang] [docs] Add llvm and clang release notes for the global-var code model attribute (PR #78664)

2024-01-19 Thread WÁNG Xuěruì via cfe-commits
@@ -70,6 +70,8 @@ Changes to the LLVM IR * Added `llvm.exp10` intrinsic. +* Added a code model attribute for the `global variable `_. xen0n wrote: Refer to the IR construct verbatim, i.e. `code_model`, for better readability? https://github.com/llvm/llvm-p

[clang] [llvm] [docs] Add llvm and clang release notes for the global-var code model attribute (PR #78664)

2024-01-19 Thread WÁNG Xuěruì via cfe-commits
@@ -1119,6 +1119,14 @@ Windows Support LoongArch Support ^ +- Added a code model attribute for the global variable. The following values xen0n wrote: "The `model` attribute is now supported for overriding the default code model used to access

[llvm] [clang] [docs] Add llvm and clang release notes for the global-var code model attribute (PR #78664)

2024-01-19 Thread WÁNG Xuěruì via cfe-commits
@@ -130,6 +132,8 @@ Changes to the Hexagon Backend Changes to the LoongArch Backend +* Respect the code model attribute of global variables when different from + their default values. xen0n wrote: "Code model of global variab

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-13 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-13 Thread WÁNG Xuěruì via cfe-commits
@@ -3408,6 +3408,8 @@ def warn_objc_redundant_literal_use : Warning< def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", " "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">; +def err_attr_codemodel_arg : Error<"code_model '%0' is not supported on

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-13 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n commented: Overall this seems fine, thanks! But I'm not sure if reporting a more generic "the model attribute is not supported on this target" for non-LoongArch would be better: it doesn't give the false impression that the target doesn't support the specified code mod

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-12 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-12 Thread WÁNG Xuěruì via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: %clang_cc1 -emit-llvm -triple loongarch64 %s -o - | FileCheck %s + +// CHECK: @_ZL2v1 ={{.*}} global i32 0, code_model "small" +static int v1 __attribute__((model("normal"))); + +void use1() { + v1 = 1; +} + +// CHECK: @v2 ={{.*}} global i32 0, code_mode

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-04 Thread WÁNG Xuěruì via cfe-commits
@@ -57,6 +57,15 @@ global variable or function should be in after translation. let Heading = "section, __declspec(allocate)"; } +def CodeModelDocs : Documentation { + let Category = DocCatVariable; + let Content = [{ +The ``model`` attribute allows you to specify a specifi

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-04 Thread WÁNG Xuěruì via cfe-commits
@@ -3369,6 +3369,33 @@ static void handleSectionAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } } +static void handleCodeModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + StringRef CM; + StringRef Str; + SourceLocation LiteralLoc; + bool Ok = false; + // Check tha

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-04 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/72078 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add per-global code model attribute (PR #72078)

2023-12-04 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n commented: There should also be a test case that shows the attribute is not supported on a non-LoongArch target. Otherwise this mostly looks fine to me, thanks for pushing this forward! https://github.com/llvm/llvm-project/pull/72078 ___

[llvm] [clang] [LoongArch] Support per-global code model attribute for LoongArch (PR #72079)

2023-12-04 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: I think we should initially only support the attribute on LoongArch. GCC's `model` attribute is only ever supported on ia64 and loongarch, yet the patch currently seems to allow other architectures to use this attribute, with LLVM code model names accepted -- this may or may not b

[clang] [clang][LoongArch] Don't imply -fdirect-access-external-data for non-PIC (PR #71887)

2023-11-09 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n commented: Looks okay, although I may be missing some places. For now I don't know if recording this fact (no copy reloc support) with a helper function somewhere would help de-duplicating the logic -- it should be the case normally but I don't know where to best put t

[clang] [Clang][LoongArch] Support builtin functions for LSX and LASX (PR #69313)

2023-10-22 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: According to [the *LLVM GitHub user guide*](https://llvm.org/docs/GitHub.html#creating-pull-requests): > If you have multiple changes you want to introduce, it’s recommended to > create separate pull requests for each change. Given you've already split your changes into several s

[clang] LoongArch fp16,fp128 basic support (PR #68851)

2023-10-12 Thread WÁNG Xuěruì via cfe-commits
@@ -214,6 +214,13 @@ LoongArchTargetLowering::LoongArchTargetLowering(const TargetMachine &TM, setOperationAction(ISD::FRINT, MVT::f64, Legal); } + setOperationAction(ISD::FP16_TO_FP,MVT::f32, Expand); + setOperationAction(ISD::FP_TO_FP16,MVT::f32,

[clang] LoongArch fp16,fp128 basic support (PR #68851)

2023-10-12 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n commented: Thanks for the contribution and welcome! As for the commit message, please take a look at the existing commits for the general feel. (For example, people typically prefix the commit title with the involved topic(s) in brackets, and use a verb phrase for the

[clang] LoongArch fp16,fp128 basic support (PR #68851)

2023-10-12 Thread WÁNG Xuěruì via cfe-commits
https://github.com/xen0n edited https://github.com/llvm/llvm-project/pull/68851 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][LoongArch] Generate _mcount instead of mcount (PR #65657)

2023-09-07 Thread WÁNG Xuěruì via cfe-commits
xen0n wrote: also cc @SixWeining (BTW we want to have a GitHub team set up for notifications and assignments apparently) It's 4 am here and I'd take a look after getting some sleep, to ensure review quality ;-) https://github.com/llvm/llvm-project/pull/65657 __