Skip to content

Commit 06e2c7d

Browse files
committed
Rebase
Created using spr 1.3.6-beta.1
2 parents 3cde466 + 76fec7d commit 06e2c7d

File tree

215 files changed

+4264
-1893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+4264
-1893
lines changed

.github/workflows/premerge.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
export CXX=/opt/llvm/bin/clang++
6666
6767
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}"
68+
- name: "Upload artifact"
69+
- name: Upload Artifacts
70+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
71+
with:
72+
name: Premerge Artifacts
73+
path: artifacts/
74+
retention-days: 5
75+
include-hidden-files: 'true'
6876

6977
premerge-checks-windows:
7078
name: Windows Premerge Checks (Test Only - Please Ignore Results)
@@ -113,6 +121,13 @@ jobs:
113121
set MAX_PARALLEL_LINK_JOBS=64
114122
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
115123
bash .ci/monolithic-windows.sh "${{ steps.vars.outputs.windows-projects }}" "${{ steps.vars.outputs.windows-check-targets }}"
124+
- name: Upload Artifacts
125+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
126+
with:
127+
name: Premerge Artifacts
128+
path: artifacts/
129+
retention-days: 5
130+
include-hidden-files: 'true'
116131

117132
premerge-check-macos:
118133
name: MacOS Premerge Checks

.mailmap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ Ramkumar Ramachandra <[email protected]> <[email protected]>
4949
Ramkumar Ramachandra <[email protected]> <[email protected]>
5050
Saleem Abdulrasool <[email protected]>
5151
52-
Wang Pengcheng <[email protected]>
53-
54-
52+
Pengcheng Wang <[email protected]>
53+
54+

clang/docs/LanguageExtensions.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,23 @@ of different sizes and signs is forbidden in binary and ternary builtins.
818818
T __builtin_elementwise_fmod(T x, T y) return The floating-point remainder of (x/y) whose sign floating point types
819819
matches the sign of x.
820820
T __builtin_elementwise_max(T x, T y) return x or y, whichever is larger integer and floating point types
821+
For floating point types, follows semantics of maxNum
822+
in IEEE 754-2008. See `LangRef
823+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
824+
for the comparison.
821825
T __builtin_elementwise_min(T x, T y) return x or y, whichever is smaller integer and floating point types
826+
For floating point types, follows semantics of minNum
827+
in IEEE 754-2008. See `LangRef
828+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
829+
for the comparison.
830+
T __builtin_elementwise_maxnum(T x, T y) return x or y, whichever is larger. Follows IEEE 754-2008 floating point types
831+
semantics (maxNum) with +0.0>-0.0. See `LangRef
832+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
833+
for the comparison.
834+
T __builtin_elementwise_minnum(T x, T y) return x or y, whichever is smaller. Follows IEEE 754-2008 floating point types
835+
semantics (minNum) with +0.0>-0.0. See `LangRef
836+
<http://llvm.org/docs/LangRef.html#llvm-min-intrinsics-comparation>`_
837+
for the comparison.
822838
T __builtin_elementwise_add_sat(T x, T y) return the sum of x and y, clamped to the range of integer types
823839
representable values for the signed/unsigned integer type.
824840
T __builtin_elementwise_sub_sat(T x, T y) return the difference of x and y, clamped to the range of integer types

clang/docs/ReleaseNotes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Potentially Breaking Changes
3838
- Fix missing diagnostics for uses of declarations when performing typename access,
3939
such as when performing member access on a '[[deprecated]]' type alias.
4040
(#GH58547)
41+
- For ARM targets when compiling assembly files, the features included in the selected CPU
42+
or Architecture's FPU are included. If you wish not to use a specific feature,
43+
the relevant ``+no`` option will need to be amended to the command line option.
4144

4245
C/C++ Language Potentially Breaking Changes
4346
-------------------------------------------
@@ -191,6 +194,7 @@ Non-comprehensive list of changes in this release
191194
- Support parsing the `cc` operand modifier and alias it to the `c` modifier (#GH127719).
192195
- Added `__builtin_elementwise_exp10`.
193196
- For AMDPGU targets, added `__builtin_v_cvt_off_f32_i4` that maps to the `v_cvt_off_f32_i4` instruction.
197+
- Added `__builtin_elementwise_minnum` and `__builtin_elementwise_maxnum`.
194198

195199
New Compiler Flags
196200
------------------
@@ -511,6 +515,7 @@ X86 Support
511515

512516
Arm and AArch64 Support
513517
^^^^^^^^^^^^^^^^^^^^^^^
518+
- For ARM targets, cc1as now considers the FPU's features for the selected CPU or Architecture.
514519

515520
Android Support
516521
^^^^^^^^^^^^^^^

clang/include/clang/Basic/Builtins.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,18 @@ def ElementwiseMin : Builtin {
13041304
let Prototype = "void(...)";
13051305
}
13061306

1307+
def ElementwiseMaxNum : Builtin {
1308+
let Spellings = ["__builtin_elementwise_maxnum"];
1309+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1310+
let Prototype = "void(...)";
1311+
}
1312+
1313+
def ElementwiseMinNum : Builtin {
1314+
let Spellings = ["__builtin_elementwise_minnum"];
1315+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1316+
let Prototype = "void(...)";
1317+
}
1318+
13071319
def ElementwiseMaximum : Builtin {
13081320
let Spellings = ["__builtin_elementwise_maximum"];
13091321
let Attributes = [NoThrow, Const, CustomTypeChecking];

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3818,6 +3818,22 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
38183818
return RValue::get(Result);
38193819
}
38203820

3821+
case Builtin::BI__builtin_elementwise_maxnum: {
3822+
Value *Op0 = EmitScalarExpr(E->getArg(0));
3823+
Value *Op1 = EmitScalarExpr(E->getArg(1));
3824+
Value *Result = Builder.CreateBinaryIntrinsic(llvm::Intrinsic::maxnum, Op0,
3825+
Op1, nullptr, "elt.maxnum");
3826+
return RValue::get(Result);
3827+
}
3828+
3829+
case Builtin::BI__builtin_elementwise_minnum: {
3830+
Value *Op0 = EmitScalarExpr(E->getArg(0));
3831+
Value *Op1 = EmitScalarExpr(E->getArg(1));
3832+
Value *Result = Builder.CreateBinaryIntrinsic(llvm::Intrinsic::minnum, Op0,
3833+
Op1, nullptr, "elt.minnum");
3834+
return RValue::get(Result);
3835+
}
3836+
38213837
case Builtin::BI__builtin_elementwise_maximum: {
38223838
Value *Op0 = EmitScalarExpr(E->getArg(0));
38233839
Value *Op1 = EmitScalarExpr(E->getArg(1));

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -679,21 +679,17 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
679679
CPUArgFPUKind != llvm::ARM::FK_INVALID ? CPUArgFPUKind : ArchArgFPUKind;
680680
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
681681
} else {
682-
bool Generic = true;
683-
if (!ForAS) {
684-
std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
685-
if (CPU != "generic")
686-
Generic = false;
687-
llvm::ARM::ArchKind ArchKind =
688-
arm::getLLVMArchKindForARM(CPU, ArchName, Triple);
689-
FPUKind = llvm::ARM::getDefaultFPU(CPU, ArchKind);
690-
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
691-
}
682+
std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
683+
bool Generic = CPU == "generic";
692684
if (Generic && (Triple.isOSWindows() || Triple.isOSDarwin()) &&
693685
getARMSubArchVersionNumber(Triple) >= 7) {
694686
FPUKind = llvm::ARM::parseFPU("neon");
695-
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
687+
} else {
688+
llvm::ARM::ArchKind ArchKind =
689+
arm::getLLVMArchKindForARM(CPU, ArchName, Triple);
690+
FPUKind = llvm::ARM::getDefaultFPU(CPU, ArchKind);
696691
}
692+
(void)llvm::ARM::getFPUFeatures(FPUKind, Features);
697693
}
698694

699695
// Now we've finished accumulating features from arch, cpu and fpu,

clang/lib/Sema/SemaChecking.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,6 +2762,8 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
27622762

27632763
// These builtins restrict the element type to floating point
27642764
// types only, and take in two arguments.
2765+
case Builtin::BI__builtin_elementwise_minnum:
2766+
case Builtin::BI__builtin_elementwise_maxnum:
27652767
case Builtin::BI__builtin_elementwise_minimum:
27662768
case Builtin::BI__builtin_elementwise_maximum:
27672769
case Builtin::BI__builtin_elementwise_atan2:

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,42 +1493,45 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) {
14931493
unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
14941494
RecordData::value_type Record[] = {MODULE_NAME};
14951495
Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);
1496-
}
14971496

1498-
if (WritingModule && WritingModule->Directory) {
1499-
SmallString<128> BaseDir;
1500-
if (PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) {
1501-
// Use the current working directory as the base path for all inputs.
1502-
auto CWD = FileMgr.getOptionalDirectoryRef(".");
1503-
BaseDir.assign(CWD->getName());
1504-
} else {
1505-
BaseDir.assign(WritingModule->Directory->getName());
1506-
}
1507-
cleanPathForOutput(FileMgr, BaseDir);
1508-
1509-
// If the home of the module is the current working directory, then we
1510-
// want to pick up the cwd of the build process loading the module, not
1511-
// our cwd, when we load this module.
1512-
if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd &&
1513-
(!PP.getHeaderSearchInfo()
1514-
.getHeaderSearchOpts()
1515-
.ModuleMapFileHomeIsCwd ||
1516-
WritingModule->Directory->getName() != ".")) {
1517-
// Module directory.
1518-
auto Abbrev = std::make_shared<BitCodeAbbrev>();
1519-
Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY));
1520-
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory
1521-
unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1497+
auto BaseDir = [&]() -> std::optional<SmallString<128>> {
1498+
if (PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd) {
1499+
// Use the current working directory as the base path for all inputs.
1500+
auto CWD = FileMgr.getOptionalDirectoryRef(".");
1501+
return CWD->getName();
1502+
}
1503+
if (WritingModule->Directory) {
1504+
return WritingModule->Directory->getName();
1505+
}
1506+
return std::nullopt;
1507+
}();
1508+
if (BaseDir) {
1509+
cleanPathForOutput(FileMgr, *BaseDir);
1510+
1511+
// If the home of the module is the current working directory, then we
1512+
// want to pick up the cwd of the build process loading the module, not
1513+
// our cwd, when we load this module.
1514+
if (!PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleFileHomeIsCwd &&
1515+
(!PP.getHeaderSearchInfo()
1516+
.getHeaderSearchOpts()
1517+
.ModuleMapFileHomeIsCwd ||
1518+
WritingModule->Directory->getName() != ".")) {
1519+
// Module directory.
1520+
auto Abbrev = std::make_shared<BitCodeAbbrev>();
1521+
Abbrev->Add(BitCodeAbbrevOp(MODULE_DIRECTORY));
1522+
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory
1523+
unsigned AbbrevCode = Stream.EmitAbbrev(std::move(Abbrev));
1524+
1525+
RecordData::value_type Record[] = {MODULE_DIRECTORY};
1526+
Stream.EmitRecordWithBlob(AbbrevCode, Record, *BaseDir);
1527+
}
15221528

1523-
RecordData::value_type Record[] = {MODULE_DIRECTORY};
1524-
Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);
1529+
// Write out all other paths relative to the base directory if possible.
1530+
BaseDirectory.assign(BaseDir->begin(), BaseDir->end());
1531+
} else if (!isysroot.empty()) {
1532+
// Write out paths relative to the sysroot if possible.
1533+
BaseDirectory = std::string(isysroot);
15251534
}
1526-
1527-
// Write out all other paths relative to the base directory if possible.
1528-
BaseDirectory.assign(BaseDir.begin(), BaseDir.end());
1529-
} else if (!isysroot.empty()) {
1530-
// Write out paths relative to the sysroot if possible.
1531-
BaseDirectory = std::string(isysroot);
15321535
}
15331536

15341537
// Module map file

0 commit comments

Comments
 (0)