Index: cfe/trunk/Driver/riscv-abi.c =================================================================== --- cfe/trunk/Driver/riscv-abi.c +++ cfe/trunk/Driver/riscv-abi.c @@ -0,0 +1,49 @@ +// REQUIRES: riscv-registered-target + +// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32 %s +// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -mabi=ilp32 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32 %s + +// CHECK-ILP32: "-target-abi" "ilp32" + +// TODO: ilp32f support. +// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=ilp32f 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32F %s + +// CHECK-ILP32F: error: unknown target ABI 'ilp32f' + +// TODO: ilp32d support. +// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=ilp32d 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ILP32D %s + +// CHECK-ILP32D: error: unknown target ABI 'ilp32d' + +// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=lp64 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-RV32-LP64 %s + +// CHECK-RV32-LP64: error: unknown target ABI 'lp64' + +// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64 %s +// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o -mabi=lp64 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64 %s + +// CHECK-LP64: "-target-abi" "lp64" + +// TODO: lp64f support. +// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=lp64f 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64F %s + +// CHECK-LP64F: error: unknown target ABI 'lp64f' + +// TODO: lp64d support. +// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=lp64d 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-LP64D %s + +// CHECK-LP64D: error: unknown target ABI 'lp64d' + +// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=ilp32 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-RV64-ILP32 %s + +// CHECK-RV64-ILP32: error: unknown target ABI 'ilp32' Index: cfe/trunk/Driver/riscv-arch.c =================================================================== --- cfe/trunk/Driver/riscv-arch.c +++ cfe/trunk/Driver/riscv-arch.c @@ -0,0 +1,319 @@ +// REQUIRES: riscv-registered-target + +// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imafd -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ic -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imac -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imafc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32imafdc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ia -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32iaf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32iafd -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv32-unknown-elf -march=rv32iac -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32iafc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32iafdc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv32-unknown-elf -march=rv32g -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv32-unknown-elf -march=rv32gc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv64-unknown-elf -march=rv64i -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64im -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64ima -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imaf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imafd -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv64-unknown-elf -march=rv64ic -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imac -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imafc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64imafdc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv64-unknown-elf -march=rv64ia -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64iaf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64iafd -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv64-unknown-elf -march=rv64iac -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64iafc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64iafdc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// RUN: %clang -target riscv64-unknown-elf -march=rv64g -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -march=rv64gc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck %s + +// CHECK-NOT: error: invalid arch name ' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32 %s +// RV32: error: invalid arch name 'rv32' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32m -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32M %s +// RV32M: error: invalid arch name 'rv32m' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32id -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ID %s +// RV32ID: error: invalid arch name 'rv32id' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32l -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32L %s +// RV32L: error: invalid arch name 'rv32l' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imadf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMADF %s +// RV32IMADF: error: invalid arch name 'rv32imadf' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imm -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMM %s +// RV32IMM: error: invalid arch name 'rv32imm' + +// RUN: %clang -target riscv32-unknown-elf -march=RV32I -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32I-UPPER %s +// RV32I-UPPER: error: invalid arch name 'RV32I' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64 %s +// RV64: error: invalid arch name 'rv64' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64m -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64M %s +// RV64M: error: invalid arch name 'rv64m' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64id -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64ID %s +// RV64ID: error: invalid arch name 'rv64id' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64l -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64L %s +// RV64L: error: invalid arch name 'rv64l' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64imadf -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMADF %s +// RV64IMADF: error: invalid arch name 'rv64imadf' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64imm -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMM %s +// RV64IMM: error: invalid arch name 'rv64imm' + +// RUN: %clang -target riscv64-unknown-elf -march=RV64I -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64I-UPPER %s +// RV64I-UPPER: error: invalid arch name 'RV64I' + + +// Testing specific messages and unsupported extensions. + +// RUN: %clang -target riscv32-unknown-elf -march=rv32e -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32E %s +// RV32E: error: invalid arch name 'rv32e', +// RV32E: standard user-level extension 'e' + +// RUN: %clang -target riscv64-unknown-elf -march=rv64e -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64E %s +// RV64E: error: invalid arch name 'rv64e', +// RV64E: standard user-level extension 'e' requires 'rv32' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imC -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LOWER %s +// RV32-LOWER: error: invalid arch name 'rv32imC', +// RV32-LOWER: string must be lowercase + +// RUN: %clang -target riscv32-unknown-elf -march=rv32 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STR %s +// RV32-STR: error: invalid arch name 'rv32', +// RV32-STR: string must begin with rv32{i,e,g} or rv64{i,g} + +// RUN: %clang -target riscv32-unknown-elf -march=rv32q -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LETTER %s +// RV32-LETTER: error: invalid arch name 'rv32q', +// RV32-LETTER: first letter should be 'e', 'i' or 'g' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imcq -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ORDER %s +// RV32-ORDER: error: invalid arch name 'rv32imcq', +// RV32-ORDER: standard user-level extension not given in canonical order 'q' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imw -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD-INVAL %s +// RV32-STD-INVAL: error: invalid arch name 'rv32imw', +// RV32-STD-INVAL: invalid standard user-level extension 'w' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imqc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD %s +// RV32-STD: error: invalid arch name 'rv32imqc', +// RV32-STD: unsupported standard user-level extension 'q' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32xabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X %s +// RV32X: error: invalid arch name 'rv32xabc', +// RV32X: first letter should be 'e', 'i' or 'g' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32sxabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX %s +// RV32SX: error: invalid arch name 'rv32sxabc', +// RV32SX: first letter should be 'e', 'i' or 'g' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32sabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S %s +// RV32S: error: invalid arch name 'rv32sabc', +// RV32S: first letter should be 'e', 'i' or 'g' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ix -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-NAME %s +// RV32X-NAME: error: invalid arch name 'rv32ix', +// RV32X-NAME: non-standard user-level extension name missing after 'x' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isx -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-NAME %s +// RV32SX-NAME: error: invalid arch name 'rv32isx', +// RV32SX-NAME: non-standard supervisor-level extension +// RV32SX-NAME: name missing after 'sx' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32is -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-NAME %s +// RV32S-NAME: error: invalid arch name 'rv32is', +// RV32S-NAME: standard supervisor-level extension +// RV32S-NAME: name missing after 's' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ix_s_sx -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL-NAME %s +// RV32ALL-NAME: error: invalid arch name 'rv32ix_s_sx', +// RV32ALL-NAME: non-standard user-level extension +// RV32ALL-NAME: name missing after 'x' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-UNS %s +// RV32X-UNS: error: invalid arch name 'rv32ixabc', +// RV32X-UNS: unsupported non-standard user-level extension 'xabc' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isa -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-UNS %s +// RV32S-UNS: error: invalid arch name 'rv32isa', +// RV32S-UNS: unsupported standard supervisor-level extension 'sa' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isxabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-UNS %s +// RV32SX-UNS: error: invalid arch name 'rv32isxabc', +// RV32SX-UNS: unsupported non-standard supervisor-level extension 'sxabc' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_sp_sxlw -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL %s +// RV32ALL: error: invalid arch name 'rv32ixabc_sp_sxlw', +// RV32ALL: unsupported non-standard user-level extension 'xabc' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32i20 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IVER %s +// RV32-IVER: error: invalid arch name 'rv32i20', unsupported +// RV32-IVER: version number 20 for extension 'i' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32imc5 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-CVER %s +// RV32-CVER: error: invalid arch name 'rv32imc5', unsupported +// RV32-CVER: version number 5 for extension 'c' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR-MISS %s +// RV32-IMINOR-MISS: error: invalid arch name 'rv32i2p', +// RV32-IMINOR-MISS: minor version number missing after 'p' for extension 'i' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p0 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR0 %s +// RV32-IMINOR0: error: invalid arch name 'rv32i2p0', +// RV32-IMINOR0: unsupported version number 2.0 for extension 'i' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p1 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR1 %s +// RV32-IMINOR1: error: invalid arch name 'rv32i2p1', unsupported +// RV32-IMINOR1: version number 2.1 for extension 'i' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ix2p -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XMINOR-MISS %s +// RV32-XMINOR-MISS: error: invalid arch name 'rv32ix2p', +// RV32-XMINOR-MISS: minor version number missing after 'p' for extension 'x2p' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32is2p0 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SMINOR0 %s +// RV32-SMINOR0: error: invalid arch name 'rv32is2p0', +// RV32-SMINOR0: unsupported version number 2.0 for extension 's2p0' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isx2p1 -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SXMINOR1 %s +// RV32-SXMINOR1: error: invalid arch name 'rv32isx2p1', unsupported +// RV32-SXMINOR1: version number 2.1 for extension 'sx2p1' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_ -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XSEP %s +// RV32-XSEP: error: invalid arch name 'rv32ixabc_', +// RV32-XSEP: extension name missing after separator '_' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_a -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-PREFIX %s +// RV32-PREFIX: error: invalid arch name 'rv32ixabc_a', +// RV32-PREFIX: invalid extension prefix 'a' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isabc_xdef -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-ORDER %s +// RV32-X-ORDER: error: invalid arch name 'rv32isabc_xdef', +// RV32-X-ORDER: non-standard user-level extension not given +// RV32-X-ORDER: in canonical order 'xdef' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32isxabc_sdef -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-S-ORDER %s +// RV32-S-ORDER: error: invalid arch name 'rv32isxabc_sdef', +// RV32-S-ORDER: standard supervisor-level extension not given +// RV32-S-ORDER: in canonical order 'sdef' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_xabc -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XDUP %s +// RV32-XDUP: error: invalid arch name 'rv32ixabc_xabc', +// RV32-XDUP: duplicated non-standard user-level extension 'xabc' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_xdef -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-X-INVAL %s +// RV32-X-X-INVAL: error: invalid arch name 'rv32ixabc_xdef', unsupported +// RV32-X-X-INVAL: non-standard user-level extension 'xabc' + +// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_sdef_sxghi -### %s \ +// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-S-SX-INVAL %s +// RV32-X-S-SX-INVAL: error: invalid arch name 'rv32ixabc_sdef_sxghi', +// RV32-X-S-SX-INVAL: unsupported non-standard user-level extension 'xabc' Index: cfe/trunk/Driver/riscv-features.c =================================================================== --- cfe/trunk/Driver/riscv-features.c +++ cfe/trunk/Driver/riscv-features.c @@ -0,0 +1,15 @@ +// REQUIRES: riscv-registered-target + +// RUN: %clang -target riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s +// RUN: %clang -target riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s + +// CHECK: fno-signed-char + +// RUN: %clang -target riscv32-unknown-elf -### %s -mrelax 2>&1 | FileCheck %s -check-prefix=RELAX +// RUN: %clang -target riscv32-unknown-elf -### %s -mno-relax 2>&1 | FileCheck %s -check-prefix=NO-RELAX +// RUN: %clang -target riscv32-unknown-elf -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT + +// RELAX: "-target-feature" "+relax" +// NO-RELAX: "-target-feature" "-relax" +// DEFAULT-NOT: "-target-feature" "+relax" +// DEFAULT-NOT: "-target-feature" "-relax" Index: cfe/trunk/Driver/riscv-gnutools.c =================================================================== --- cfe/trunk/Driver/riscv-gnutools.c +++ cfe/trunk/Driver/riscv-gnutools.c @@ -0,0 +1,21 @@ +// REQUIRES: riscv-registered-target + +// Check gnutools are invoked with propagated values for -mabi and -march. + +// RUN: %clang -target riscv32 -fno-integrated-as %s -### -c \ +// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32 %s + +// RUN: %clang -target riscv32 -fno-integrated-as -march=rv32g %s -### -c \ +// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32-MARCH-G %s + +// RUN: %clang -target riscv64 -fno-integrated-as %s -### -c \ +// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64 %s + +// RUN: %clang -target riscv64 -fno-integrated-as -march=rv64g %s -### -c \ +// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64-MARCH-G %s + +// MABI-ILP32: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" +// MABI-ILP32-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" "-march" "rv32g" + +// MABI-ILP64: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" +// MABI-ILP64-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" "-march" "rv64g" Index: cfe/trunk/Driver/riscv32-toolchain.c =================================================================== --- cfe/trunk/Driver/riscv32-toolchain.c +++ cfe/trunk/Driver/riscv32-toolchain.c @@ -0,0 +1,189 @@ +// REQUIRES: riscv-registered-target + +// A basic clang -cc1 command-line, and simple environment check. + +// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 2>&1 | FileCheck -check-prefix=CC1 %s +// CC1: clang{{.*}} "-cc1" "-triple" "riscv32" + +// RUN: %clang %s -### -no-canonical-prefixes \ +// RUN: -target riscv32-unknown-elf \ +// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \ +// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \ +// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32 %s + +// C-RV32-BAREMETAL-ILP32: "-fuse-init-array" +// C-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" +// C-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf" +// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" +// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" +// C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib" +// C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" +// C-RV32-BAREMETAL-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" +// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" + +// RUN: %clang %s -### -no-canonical-prefixes \ +// RUN: -target riscv32-unknown-elf \ +// RUN: --sysroot= \ +// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \ +// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s + +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-fuse-init-array" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf{{/|\\\\}}lib" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" +// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" + +// RUN: %clangxx %s -### -no-canonical-prefixes \ +// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ \ +// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \ +// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \ +// RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-ILP32 %s + +// CXX-RV32-BAREMETAL-ILP32: "-fuse-init-array" +// CXX-RV32-BAREMETAL-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++{{/|\\\\}}8.0.1" +// CXX-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" +// CXX-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf" +// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" +// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" +// CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib" +// CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" +// CXX-RV32-BAREMETAL-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" +// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" + +// RUN: %clangxx %s -### -no-canonical-prefixes \ +// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ \ +// RUN: --sysroot= \ +// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \ +// RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s + +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-fuse-init-array" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/include/c++{{/|\\\\}}8.0.1" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" +// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" + +// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ +// RUN: -target riscv32-linux-unknown-elf \ +// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ +// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ +// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32 %s + +// C-RV32-LINUX-MULTI-ILP32: "-fuse-init-array" +// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../../../riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" +// C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" +// C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" +// C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1" +// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o" +// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32" +// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32" +// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32" + +// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ +// RUN: -target riscv32-linux-unknown-elf -march=rv32imafd -mabi=ilp32d \ +// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ +// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ +// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32D %s + +// C-RV32-LINUX-MULTI-ILP32D: "-fuse-init-array" +// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../../../riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" +// C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" +// C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv" +// C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1" +// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o" +// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d" +// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d" +// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d" + +// RUN: %clang -target riscv32 %s -emit-llvm -S -o - | FileCheck %s + +typedef __builtin_va_list va_list; +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __WCHAR_TYPE__ wchar_t; + +// CHECK: @align_c = dso_local global i32 1 +int align_c = __alignof(char); + +// CHECK: @align_s = dso_local global i32 2 +int align_s = __alignof(short); + +// CHECK: @align_i = dso_local global i32 4 +int align_i = __alignof(int); + +// CHECK: @align_wc = dso_local global i32 4 +int align_wc = __alignof(wchar_t); + +// CHECK: @align_l = dso_local global i32 4 +int align_l = __alignof(long); + +// CHECK: @align_ll = dso_local global i32 8 +int align_ll = __alignof(long long); + +// CHECK: @align_p = dso_local global i32 4 +int align_p = __alignof(void*); + +// CHECK: @align_f = dso_local global i32 4 +int align_f = __alignof(float); + +// CHECK: @align_d = dso_local global i32 8 +int align_d = __alignof(double); + +// CHECK: @align_ld = dso_local global i32 16 +int align_ld = __alignof(long double); + +// CHECK: @align_vl = dso_local global i32 4 +int align_vl = __alignof(va_list); + +// Check types + +// CHECK: zeroext i8 @check_char() +char check_char() { return 0; } + +// CHECK: define dso_local signext i16 @check_short() +short check_short() { return 0; } + +// CHECK: define dso_local i32 @check_int() +int check_int() { return 0; } + +// CHECK: define dso_local i32 @check_wchar_t() +int check_wchar_t() { return 0; } + +// CHECK: define dso_local i32 @check_long() +long check_long() { return 0; } + +// CHECK: define dso_local i64 @check_longlong() +long long check_longlong() { return 0; } + +// CHECK: define dso_local zeroext i8 @check_uchar() +unsigned char check_uchar() { return 0; } + +// CHECK: define dso_local zeroext i16 @check_ushort() +unsigned short check_ushort() { return 0; } + +// CHECK: define dso_local i32 @check_uint() +unsigned int check_uint() { return 0; } + +// CHECK: define dso_local i32 @check_ulong() +unsigned long check_ulong() { return 0; } + +// CHECK: define dso_local i64 @check_ulonglong() +unsigned long long check_ulonglong() { return 0; } + +// CHECK: define dso_local i32 @check_size_t() +size_t check_size_t() { return 0; } + +// CHECK: define dso_local float @check_float() +float check_float() { return 0; } + +// CHECK: define dso_local double @check_double() +double check_double() { return 0; } + +// CHECK: define dso_local fp128 @check_longdouble() +long double check_longdouble() { return 0; } Index: cfe/trunk/Driver/riscv64-toolchain.c =================================================================== --- cfe/trunk/Driver/riscv64-toolchain.c +++ cfe/trunk/Driver/riscv64-toolchain.c @@ -0,0 +1,93 @@ +// REQUIRES: riscv-registered-target + +// A basic clang -cc1 command-line, and simple environment check. + +// RUN: %clang %s -### -no-canonical-prefixes -target riscv64 2>&1 | FileCheck -check-prefix=CC1 %s +// CC1: clang{{.*}} "-cc1" "-triple" "riscv64" + +// RUN: %clang -target riscv64 %s -emit-llvm -S -o - | FileCheck %s + +typedef __builtin_va_list va_list; +typedef __SIZE_TYPE__ size_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __WCHAR_TYPE__ wchar_t; + +// CHECK: @align_c = dso_local global i32 1 +int align_c = __alignof(char); + +// CHECK: @align_s = dso_local global i32 2 +int align_s = __alignof(short); + +// CHECK: @align_i = dso_local global i32 4 +int align_i = __alignof(int); + +// CHECK: @align_wc = dso_local global i32 4 +int align_wc = __alignof(wchar_t); + +// CHECK: @align_l = dso_local global i32 8 +int align_l = __alignof(long); + +// CHECK: @align_ll = dso_local global i32 8 +int align_ll = __alignof(long long); + +// CHECK: @align_p = dso_local global i32 8 +int align_p = __alignof(void*); + +// CHECK: @align_f = dso_local global i32 4 +int align_f = __alignof(float); + +// CHECK: @align_d = dso_local global i32 8 +int align_d = __alignof(double); + +// CHECK: @align_ld = dso_local global i32 16 +int align_ld = __alignof(long double); + +// CHECK: @align_vl = dso_local global i32 8 +int align_vl = __alignof(va_list); + +// Check types + +// CHECK: define dso_local zeroext i8 @check_char() +char check_char() { return 0; } + +// CHECK: define dso_local signext i16 @check_short() +short check_short() { return 0; } + +// CHECK: define dso_local signext i32 @check_int() +int check_int() { return 0; } + +// CHECK: define dso_local signext i32 @check_wchar_t() +int check_wchar_t() { return 0; } + +// CHECK: define dso_local i64 @check_long() +long check_long() { return 0; } + +// CHECK: define dso_local i64 @check_longlong() +long long check_longlong() { return 0; } + +// CHECK: define dso_local zeroext i8 @check_uchar() +unsigned char check_uchar() { return 0; } + +// CHECK: define dso_local zeroext i16 @check_ushort() +unsigned short check_ushort() { return 0; } + +// CHECK: define dso_local signext i32 @check_uint() +unsigned int check_uint() { return 0; } + +// CHECK: define dso_local i64 @check_ulong() +unsigned long check_ulong() { return 0; } + +// CHECK: define dso_local i64 @check_ulonglong() +unsigned long long check_ulonglong() { return 0; } + +// CHECK: define dso_local i64 @check_size_t() +size_t check_size_t() { return 0; } + +// CHECK: define dso_local float @check_float() +float check_float() { return 0; } + +// CHECK: define dso_local double @check_double() +double check_double() { return 0; } + +// CHECK: define dso_local fp128 @check_longdouble() +long double check_longdouble() { return 0; } Index: cfe/trunk/test/Driver/riscv-abi.c =================================================================== --- cfe/trunk/test/Driver/riscv-abi.c +++ cfe/trunk/test/Driver/riscv-abi.c @@ -1,47 +0,0 @@ -// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ILP32 %s -// RUN: %clang -target riscv32-unknown-elf %s -### -o %t.o -mabi=ilp32 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ILP32 %s - -// CHECK-ILP32: "-target-abi" "ilp32" - -// TODO: ilp32f support. -// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=ilp32f 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ILP32F %s - -// CHECK-ILP32F: error: unknown target ABI 'ilp32f' - -// TODO: ilp32d support. -// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=ilp32d 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-ILP32D %s - -// CHECK-ILP32D: error: unknown target ABI 'ilp32d' - -// RUN: not %clang -target riscv32-unknown-elf %s -o %t.o -mabi=lp64 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-RV32-LP64 %s - -// CHECK-RV32-LP64: error: unknown target ABI 'lp64' - -// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-LP64 %s -// RUN: %clang -target riscv64-unknown-elf %s -### -o %t.o -mabi=lp64 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-LP64 %s - -// CHECK-LP64: "-target-abi" "lp64" - -// TODO: lp64f support. -// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=lp64f 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-LP64F %s - -// CHECK-LP64F: error: unknown target ABI 'lp64f' - -// TODO: lp64d support. -// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=lp64d 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-LP64D %s - -// CHECK-LP64D: error: unknown target ABI 'lp64d' - -// RUN: not %clang -target riscv64-unknown-elf %s -o %t.o -mabi=ilp32 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK-RV64-ILP32 %s - -// CHECK-RV64-ILP32: error: unknown target ABI 'ilp32' Index: cfe/trunk/test/Driver/riscv-arch.c =================================================================== --- cfe/trunk/test/Driver/riscv-arch.c +++ cfe/trunk/test/Driver/riscv-arch.c @@ -1,317 +0,0 @@ -// RUN: %clang -target riscv32-unknown-elf -march=rv32i -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32im -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32ima -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imaf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imafd -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ic -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imac -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imafc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32imafdc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ia -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32iaf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32iafd -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv32-unknown-elf -march=rv32iac -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32iafc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32iafdc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv32-unknown-elf -march=rv32g -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-unknown-elf -march=rv32gc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv64-unknown-elf -march=rv64i -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64im -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64ima -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imaf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imafd -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv64-unknown-elf -march=rv64ic -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imac -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imafc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64imafdc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv64-unknown-elf -march=rv64ia -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64iaf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64iafd -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv64-unknown-elf -march=rv64iac -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64iafc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64iafdc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// RUN: %clang -target riscv64-unknown-elf -march=rv64g -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -march=rv64gc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck %s - -// CHECK-NOT: error: invalid arch name ' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32 %s -// RV32: error: invalid arch name 'rv32' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32m -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32M %s -// RV32M: error: invalid arch name 'rv32m' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32id -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ID %s -// RV32ID: error: invalid arch name 'rv32id' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32l -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32L %s -// RV32L: error: invalid arch name 'rv32l' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imadf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMADF %s -// RV32IMADF: error: invalid arch name 'rv32imadf' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imm -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32IMM %s -// RV32IMM: error: invalid arch name 'rv32imm' - -// RUN: %clang -target riscv32-unknown-elf -march=RV32I -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32I-UPPER %s -// RV32I-UPPER: error: invalid arch name 'RV32I' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64 %s -// RV64: error: invalid arch name 'rv64' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64m -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64M %s -// RV64M: error: invalid arch name 'rv64m' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64id -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64ID %s -// RV64ID: error: invalid arch name 'rv64id' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64l -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64L %s -// RV64L: error: invalid arch name 'rv64l' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64imadf -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMADF %s -// RV64IMADF: error: invalid arch name 'rv64imadf' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64imm -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64IMM %s -// RV64IMM: error: invalid arch name 'rv64imm' - -// RUN: %clang -target riscv64-unknown-elf -march=RV64I -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64I-UPPER %s -// RV64I-UPPER: error: invalid arch name 'RV64I' - - -// Testing specific messages and unsupported extensions. - -// RUN: %clang -target riscv32-unknown-elf -march=rv32e -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32E %s -// RV32E: error: invalid arch name 'rv32e', -// RV32E: standard user-level extension 'e' - -// RUN: %clang -target riscv64-unknown-elf -march=rv64e -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV64E %s -// RV64E: error: invalid arch name 'rv64e', -// RV64E: standard user-level extension 'e' requires 'rv32' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imC -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LOWER %s -// RV32-LOWER: error: invalid arch name 'rv32imC', -// RV32-LOWER: string must be lowercase - -// RUN: %clang -target riscv32-unknown-elf -march=rv32 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STR %s -// RV32-STR: error: invalid arch name 'rv32', -// RV32-STR: string must begin with rv32{i,e,g} or rv64{i,g} - -// RUN: %clang -target riscv32-unknown-elf -march=rv32q -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-LETTER %s -// RV32-LETTER: error: invalid arch name 'rv32q', -// RV32-LETTER: first letter should be 'e', 'i' or 'g' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imcq -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-ORDER %s -// RV32-ORDER: error: invalid arch name 'rv32imcq', -// RV32-ORDER: standard user-level extension not given in canonical order 'q' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imw -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD-INVAL %s -// RV32-STD-INVAL: error: invalid arch name 'rv32imw', -// RV32-STD-INVAL: invalid standard user-level extension 'w' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imqc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-STD %s -// RV32-STD: error: invalid arch name 'rv32imqc', -// RV32-STD: unsupported standard user-level extension 'q' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32xabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X %s -// RV32X: error: invalid arch name 'rv32xabc', -// RV32X: first letter should be 'e', 'i' or 'g' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32sxabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX %s -// RV32SX: error: invalid arch name 'rv32sxabc', -// RV32SX: first letter should be 'e', 'i' or 'g' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32sabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S %s -// RV32S: error: invalid arch name 'rv32sabc', -// RV32S: first letter should be 'e', 'i' or 'g' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ix -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-NAME %s -// RV32X-NAME: error: invalid arch name 'rv32ix', -// RV32X-NAME: non-standard user-level extension name missing after 'x' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isx -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-NAME %s -// RV32SX-NAME: error: invalid arch name 'rv32isx', -// RV32SX-NAME: non-standard supervisor-level extension -// RV32SX-NAME: name missing after 'sx' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32is -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-NAME %s -// RV32S-NAME: error: invalid arch name 'rv32is', -// RV32S-NAME: standard supervisor-level extension -// RV32S-NAME: name missing after 's' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ix_s_sx -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL-NAME %s -// RV32ALL-NAME: error: invalid arch name 'rv32ix_s_sx', -// RV32ALL-NAME: non-standard user-level extension -// RV32ALL-NAME: name missing after 'x' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32X-UNS %s -// RV32X-UNS: error: invalid arch name 'rv32ixabc', -// RV32X-UNS: unsupported non-standard user-level extension 'xabc' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isa -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32S-UNS %s -// RV32S-UNS: error: invalid arch name 'rv32isa', -// RV32S-UNS: unsupported standard supervisor-level extension 'sa' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isxabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32SX-UNS %s -// RV32SX-UNS: error: invalid arch name 'rv32isxabc', -// RV32SX-UNS: unsupported non-standard supervisor-level extension 'sxabc' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_sp_sxlw -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32ALL %s -// RV32ALL: error: invalid arch name 'rv32ixabc_sp_sxlw', -// RV32ALL: unsupported non-standard user-level extension 'xabc' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32i20 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IVER %s -// RV32-IVER: error: invalid arch name 'rv32i20', unsupported -// RV32-IVER: version number 20 for extension 'i' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32imc5 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-CVER %s -// RV32-CVER: error: invalid arch name 'rv32imc5', unsupported -// RV32-CVER: version number 5 for extension 'c' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR-MISS %s -// RV32-IMINOR-MISS: error: invalid arch name 'rv32i2p', -// RV32-IMINOR-MISS: minor version number missing after 'p' for extension 'i' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p0 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR0 %s -// RV32-IMINOR0: error: invalid arch name 'rv32i2p0', -// RV32-IMINOR0: unsupported version number 2.0 for extension 'i' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32i2p1 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-IMINOR1 %s -// RV32-IMINOR1: error: invalid arch name 'rv32i2p1', unsupported -// RV32-IMINOR1: version number 2.1 for extension 'i' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ix2p -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XMINOR-MISS %s -// RV32-XMINOR-MISS: error: invalid arch name 'rv32ix2p', -// RV32-XMINOR-MISS: minor version number missing after 'p' for extension 'x2p' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32is2p0 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SMINOR0 %s -// RV32-SMINOR0: error: invalid arch name 'rv32is2p0', -// RV32-SMINOR0: unsupported version number 2.0 for extension 's2p0' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isx2p1 -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-SXMINOR1 %s -// RV32-SXMINOR1: error: invalid arch name 'rv32isx2p1', unsupported -// RV32-SXMINOR1: version number 2.1 for extension 'sx2p1' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_ -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XSEP %s -// RV32-XSEP: error: invalid arch name 'rv32ixabc_', -// RV32-XSEP: extension name missing after separator '_' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_a -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-PREFIX %s -// RV32-PREFIX: error: invalid arch name 'rv32ixabc_a', -// RV32-PREFIX: invalid extension prefix 'a' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isabc_xdef -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-ORDER %s -// RV32-X-ORDER: error: invalid arch name 'rv32isabc_xdef', -// RV32-X-ORDER: non-standard user-level extension not given -// RV32-X-ORDER: in canonical order 'xdef' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32isxabc_sdef -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-S-ORDER %s -// RV32-S-ORDER: error: invalid arch name 'rv32isxabc_sdef', -// RV32-S-ORDER: standard supervisor-level extension not given -// RV32-S-ORDER: in canonical order 'sdef' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_xabc -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-XDUP %s -// RV32-XDUP: error: invalid arch name 'rv32ixabc_xabc', -// RV32-XDUP: duplicated non-standard user-level extension 'xabc' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_xdef -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-X-INVAL %s -// RV32-X-X-INVAL: error: invalid arch name 'rv32ixabc_xdef', unsupported -// RV32-X-X-INVAL: non-standard user-level extension 'xabc' - -// RUN: %clang -target riscv32-unknown-elf -march=rv32ixabc_sdef_sxghi -### %s \ -// RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-X-S-SX-INVAL %s -// RV32-X-S-SX-INVAL: error: invalid arch name 'rv32ixabc_sdef_sxghi', -// RV32-X-S-SX-INVAL: unsupported non-standard user-level extension 'xabc' Index: cfe/trunk/test/Driver/riscv-features.c =================================================================== --- cfe/trunk/test/Driver/riscv-features.c +++ cfe/trunk/test/Driver/riscv-features.c @@ -1,13 +0,0 @@ -// RUN: %clang -target riscv32-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-unknown-elf -### %s -fsyntax-only 2>&1 | FileCheck %s - -// CHECK: fno-signed-char - -// RUN: %clang -target riscv32-unknown-elf -### %s -mrelax 2>&1 | FileCheck %s -check-prefix=RELAX -// RUN: %clang -target riscv32-unknown-elf -### %s -mno-relax 2>&1 | FileCheck %s -check-prefix=NO-RELAX -// RUN: %clang -target riscv32-unknown-elf -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT - -// RELAX: "-target-feature" "+relax" -// NO-RELAX: "-target-feature" "-relax" -// DEFAULT-NOT: "-target-feature" "+relax" -// DEFAULT-NOT: "-target-feature" "-relax" Index: cfe/trunk/test/Driver/riscv-gnutools.c =================================================================== --- cfe/trunk/test/Driver/riscv-gnutools.c +++ cfe/trunk/test/Driver/riscv-gnutools.c @@ -1,19 +0,0 @@ -// Check gnutools are invoked with propagated values for -mabi and -march. - -// RUN: %clang -target riscv32 -fno-integrated-as %s -### -c \ -// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32 %s - -// RUN: %clang -target riscv32 -fno-integrated-as -march=rv32g %s -### -c \ -// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP32-MARCH-G %s - -// RUN: %clang -target riscv64 -fno-integrated-as %s -### -c \ -// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64 %s - -// RUN: %clang -target riscv64 -fno-integrated-as -march=rv64g %s -### -c \ -// RUN: 2>&1 | FileCheck -check-prefix=MABI-ILP64-MARCH-G %s - -// MABI-ILP32: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" -// MABI-ILP32-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "ilp32" "-march" "rv32g" - -// MABI-ILP64: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" -// MABI-ILP64-MARCH-G: "{{.*}}as{{(.exe)?}}" "-mabi" "lp64" "-march" "rv64g" Index: cfe/trunk/test/Driver/riscv32-toolchain.c =================================================================== --- cfe/trunk/test/Driver/riscv32-toolchain.c +++ cfe/trunk/test/Driver/riscv32-toolchain.c @@ -1,187 +0,0 @@ -// A basic clang -cc1 command-line, and simple environment check. - -// RUN: %clang %s -### -no-canonical-prefixes -target riscv32 2>&1 | FileCheck -check-prefix=CC1 %s -// CC1: clang{{.*}} "-cc1" "-triple" "riscv32" - -// RUN: %clang %s -### -no-canonical-prefixes \ -// RUN: -target riscv32-unknown-elf \ -// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \ -// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \ -// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32 %s - -// C-RV32-BAREMETAL-ILP32: "-fuse-init-array" -// C-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" -// C-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf" -// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" -// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" -// C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib" -// C-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" -// C-RV32-BAREMETAL-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" -// C-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" - -// RUN: %clang %s -### -no-canonical-prefixes \ -// RUN: -target riscv32-unknown-elf \ -// RUN: --sysroot= \ -// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \ -// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-NOSYSROOT-ILP32 %s - -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-fuse-init-array" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf{{/|\\\\}}lib" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" -// C-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" - -// RUN: %clangxx %s -### -no-canonical-prefixes \ -// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ \ -// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree \ -// RUN: --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \ -// RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-ILP32 %s - -// CXX-RV32-BAREMETAL-ILP32: "-fuse-init-array" -// CXX-RV32-BAREMETAL-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/riscv32-unknown-elf/include/c++{{/|\\\\}}8.0.1" -// CXX-RV32-BAREMETAL-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" -// CXX-RV32-BAREMETAL-ILP32: "--sysroot={{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf" -// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" -// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" -// CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/riscv32-unknown-elf/lib" -// CXX-RV32-BAREMETAL-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" -// CXX-RV32-BAREMETAL-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" -// CXX-RV32-BAREMETAL-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" - -// RUN: %clangxx %s -### -no-canonical-prefixes \ -// RUN: -target riscv32-unknown-elf -stdlib=libstdc++ \ -// RUN: --sysroot= \ -// RUN: --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \ -// RUN: | FileCheck -check-prefix=CXX-RV32-BAREMETAL-NOSYSROOT-ILP32 %s - -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-fuse-init-array" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-internal-isystem" "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/include/c++{{/|\\\\}}8.0.1" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../bin{{/|\\\\}}riscv32-unknown-elf-ld" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib{{/|\\\\}}crt0.o" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtbegin.o" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1/../../../../riscv32-unknown-elf/lib" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-L{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" "--end-group" "-lgcc" -// CXX-RV32-BAREMETAL-NOSYSROOT-ILP32: "{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|\\\\}}crtend.o" - -// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ -// RUN: -target riscv32-linux-unknown-elf \ -// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ -// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ -// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32 %s - -// C-RV32-LINUX-MULTI-ILP32: "-fuse-init-array" -// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../../../riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" -// C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" -// C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" -// C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1" -// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o" -// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32" -// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32" -// C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32" - -// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld=ld \ -// RUN: -target riscv32-linux-unknown-elf -march=rv32imafd -mabi=ilp32d \ -// RUN: --gcc-toolchain=%S/Inputs/multilib_riscv_linux_sdk \ -// RUN: --sysroot=%S/Inputs/multilib_riscv_linux_sdk/sysroot 2>&1 \ -// RUN: | FileCheck -check-prefix=C-RV32-LINUX-MULTI-ILP32D %s - -// C-RV32-LINUX-MULTI-ILP32D: "-fuse-init-array" -// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/../../../../riscv64-unknown-linux-gnu/bin{{/|\\\\}}ld" -// C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" -// C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv" -// C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1" -// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o" -// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d" -// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d" -// C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d" - -// RUN: %clang -target riscv32 %s -emit-llvm -S -o - | FileCheck %s - -typedef __builtin_va_list va_list; -typedef __SIZE_TYPE__ size_t; -typedef __PTRDIFF_TYPE__ ptrdiff_t; -typedef __WCHAR_TYPE__ wchar_t; - -// CHECK: @align_c = dso_local global i32 1 -int align_c = __alignof(char); - -// CHECK: @align_s = dso_local global i32 2 -int align_s = __alignof(short); - -// CHECK: @align_i = dso_local global i32 4 -int align_i = __alignof(int); - -// CHECK: @align_wc = dso_local global i32 4 -int align_wc = __alignof(wchar_t); - -// CHECK: @align_l = dso_local global i32 4 -int align_l = __alignof(long); - -// CHECK: @align_ll = dso_local global i32 8 -int align_ll = __alignof(long long); - -// CHECK: @align_p = dso_local global i32 4 -int align_p = __alignof(void*); - -// CHECK: @align_f = dso_local global i32 4 -int align_f = __alignof(float); - -// CHECK: @align_d = dso_local global i32 8 -int align_d = __alignof(double); - -// CHECK: @align_ld = dso_local global i32 16 -int align_ld = __alignof(long double); - -// CHECK: @align_vl = dso_local global i32 4 -int align_vl = __alignof(va_list); - -// Check types - -// CHECK: zeroext i8 @check_char() -char check_char() { return 0; } - -// CHECK: define dso_local signext i16 @check_short() -short check_short() { return 0; } - -// CHECK: define dso_local i32 @check_int() -int check_int() { return 0; } - -// CHECK: define dso_local i32 @check_wchar_t() -int check_wchar_t() { return 0; } - -// CHECK: define dso_local i32 @check_long() -long check_long() { return 0; } - -// CHECK: define dso_local i64 @check_longlong() -long long check_longlong() { return 0; } - -// CHECK: define dso_local zeroext i8 @check_uchar() -unsigned char check_uchar() { return 0; } - -// CHECK: define dso_local zeroext i16 @check_ushort() -unsigned short check_ushort() { return 0; } - -// CHECK: define dso_local i32 @check_uint() -unsigned int check_uint() { return 0; } - -// CHECK: define dso_local i32 @check_ulong() -unsigned long check_ulong() { return 0; } - -// CHECK: define dso_local i64 @check_ulonglong() -unsigned long long check_ulonglong() { return 0; } - -// CHECK: define dso_local i32 @check_size_t() -size_t check_size_t() { return 0; } - -// CHECK: define dso_local float @check_float() -float check_float() { return 0; } - -// CHECK: define dso_local double @check_double() -double check_double() { return 0; } - -// CHECK: define dso_local fp128 @check_longdouble() -long double check_longdouble() { return 0; } Index: cfe/trunk/test/Driver/riscv64-toolchain.c =================================================================== --- cfe/trunk/test/Driver/riscv64-toolchain.c +++ cfe/trunk/test/Driver/riscv64-toolchain.c @@ -1,91 +0,0 @@ -// A basic clang -cc1 command-line, and simple environment check. - -// RUN: %clang %s -### -no-canonical-prefixes -target riscv64 2>&1 | FileCheck -check-prefix=CC1 %s -// CC1: clang{{.*}} "-cc1" "-triple" "riscv64" - -// RUN: %clang -target riscv64 %s -emit-llvm -S -o - | FileCheck %s - -typedef __builtin_va_list va_list; -typedef __SIZE_TYPE__ size_t; -typedef __PTRDIFF_TYPE__ ptrdiff_t; -typedef __WCHAR_TYPE__ wchar_t; - -// CHECK: @align_c = dso_local global i32 1 -int align_c = __alignof(char); - -// CHECK: @align_s = dso_local global i32 2 -int align_s = __alignof(short); - -// CHECK: @align_i = dso_local global i32 4 -int align_i = __alignof(int); - -// CHECK: @align_wc = dso_local global i32 4 -int align_wc = __alignof(wchar_t); - -// CHECK: @align_l = dso_local global i32 8 -int align_l = __alignof(long); - -// CHECK: @align_ll = dso_local global i32 8 -int align_ll = __alignof(long long); - -// CHECK: @align_p = dso_local global i32 8 -int align_p = __alignof(void*); - -// CHECK: @align_f = dso_local global i32 4 -int align_f = __alignof(float); - -// CHECK: @align_d = dso_local global i32 8 -int align_d = __alignof(double); - -// CHECK: @align_ld = dso_local global i32 16 -int align_ld = __alignof(long double); - -// CHECK: @align_vl = dso_local global i32 8 -int align_vl = __alignof(va_list); - -// Check types - -// CHECK: define dso_local zeroext i8 @check_char() -char check_char() { return 0; } - -// CHECK: define dso_local signext i16 @check_short() -short check_short() { return 0; } - -// CHECK: define dso_local signext i32 @check_int() -int check_int() { return 0; } - -// CHECK: define dso_local signext i32 @check_wchar_t() -int check_wchar_t() { return 0; } - -// CHECK: define dso_local i64 @check_long() -long check_long() { return 0; } - -// CHECK: define dso_local i64 @check_longlong() -long long check_longlong() { return 0; } - -// CHECK: define dso_local zeroext i8 @check_uchar() -unsigned char check_uchar() { return 0; } - -// CHECK: define dso_local zeroext i16 @check_ushort() -unsigned short check_ushort() { return 0; } - -// CHECK: define dso_local signext i32 @check_uint() -unsigned int check_uint() { return 0; } - -// CHECK: define dso_local i64 @check_ulong() -unsigned long check_ulong() { return 0; } - -// CHECK: define dso_local i64 @check_ulonglong() -unsigned long long check_ulonglong() { return 0; } - -// CHECK: define dso_local i64 @check_size_t() -size_t check_size_t() { return 0; } - -// CHECK: define dso_local float @check_float() -float check_float() { return 0; } - -// CHECK: define dso_local double @check_double() -double check_double() { return 0; } - -// CHECK: define dso_local fp128 @check_longdouble() -long double check_longdouble() { return 0; }