From 363d1c3c5580e99875e6be6b6f24b0afd1622292 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 1 Oct 2012 07:33:27 +0000 Subject: [PATCH] Use constants for all return values in switch. Allows clang to optimize it into a lookup table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164926 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp index 348236316c8..02b586bb7cf 100644 --- a/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp +++ b/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp @@ -243,9 +243,14 @@ unsigned X86_MC::getX86RegNum(unsigned RegNo) { case X86::R15: case X86::R15D: case X86::R15W: case X86::R15B: return N86::EDI; - case X86::ST0: case X86::ST1: case X86::ST2: case X86::ST3: - case X86::ST4: case X86::ST5: case X86::ST6: case X86::ST7: - return RegNo-X86::ST0; + case X86::ST0: return 0; + case X86::ST1: return 1; + case X86::ST2: return 2; + case X86::ST3: return 3; + case X86::ST4: return 4; + case X86::ST5: return 5; + case X86::ST6: return 6; + case X86::ST7: return 7; case X86::XMM0: case X86::XMM8: case X86::YMM0: case X86::YMM8: case X86::MM0: