This matches gcc. This means that by default, under x86-64's medium code model we treat globals < 2^16 bytes as "small data" and globals >= 2^16 bytes as "large data". The previous clang behavior of treating all data as "large data" can be set with `-mlarge-data-threshold=0`. See https://discourse.llvm.org/t/rfc-matching-gccs-mlarge-data-threshold-for-x86-64s-medium-code-model/73727.
20 lines
810 B
C
20 lines
810 B
C
// REQUIRES: x86-registered-target
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=medium | FileCheck %s --check-prefix=IR-DEFAULT
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm %s -o - -mcmodel=medium -mlarge-data-threshold=200 | FileCheck %s --check-prefix=IR-CUSTOM
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S %s -o - -mcmodel=medium -mlarge-data-threshold=200 | FileCheck %s --check-prefix=ASM-SMALL
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S %s -o - -mcmodel=medium -mlarge-data-threshold=2 | FileCheck %s --check-prefix=ASM-LARGE
|
|
|
|
// IR-DEFAULT: !{i32 1, !"Large Data Threshold", i64 65535}
|
|
// IR-CUSTOM: !{i32 1, !"Large Data Threshold", i64 200}
|
|
|
|
// ASM-SMALL-NOT: movabsq
|
|
// ASM-LARGE: movabsq
|
|
|
|
static int i;
|
|
|
|
int f() {
|
|
return i;
|
|
}
|
|
|